Determine serial port settings for your scale

You are here:

Getting started

First you must determine the communication parameters for your scale.

You will need to know:

  • Baud rate
  • Data bits
  • Stop bits
  • Parity
  • Flow control, typically none, hardware or Xon/Xoff
  • Communication method: continuous or on-demand
  • Any terminators
  • A request string, if required

The best place to start is the user manual for the scale. If you do not have one, try performing a web search for the manufacturer and model number. Also, if the scale is already connected to a computer, check the settings used in the current program.

You should also try resetting the scale to “Factory defaults”. This ensures that the settings of the scale match the default settings in the handbook.

You can also consider using Windows Hyperterm or Tera Term to determine the correct settings and then transfer them to ERP-Scale.

Further consider the contacting the scale manufacturer, often they can advise you on the correct settings and assist with the set-up.

Communication settings

Add the port settings

Set the port, Baud, Databits, Parity & Stop-bits to match the devices settings.

At this stage set both Rx and Tx handshake as “None”.

Add the Receiving settings

At first we want to see what data is being received regardless of any terminator.

Do not use a terminator, but set the terminate input after to 30 chars.

Also set a high timeout to ensure we get a good sample of data.

Add the Requesting settings

Continuous or On-Demand ?

Most scales transmit the weight data continuously, in this case no request is required, however other scales use “on-demand” communication which requires a string to be sent to the scale before the weight is transmitted. If the scale only supports a “print” mode, which requires a button on the indicator to be pressed before transmitting the weight, it will work with
ERP-Scale, but will not be practical in daily operation.

If the scale supports continuous & on-demand, we advise using continuous mode for the initial set-up, and then switching to on-demand once the basic communication is functioning.

Unless your device specifically requires it, do not set a request string.

Ensure that the request text field is empty.
Also make sure that the Terminator check box is not ticked.If the scale supports continuous & on-demand, we advise using continuous mode for the initial set-up, and then switching to on-demand once the basic communication is functioning.

Test the initial settings

Click on the menu option “Test” to display the port monitor.

Click on “Simulate” to check for incoming data.

If you see data being received, which matches the data you are expecting from the device, proceed to step 4.

If you get the exception “The operation has timed out”, close the serial port monitor and continue with step 3.

Handshake

If no data is received, then the handshake settings are probably wrong.

Return to the Port settings tab.

Try changing the RX Handshake to “RequestToSend”, and repeat step 2.

Then change the RX Handshake to “XonXoff”, and repeat step 2.

Then change the RX Handshake to “RequestToSendXonSoff”, and repeat step 2.

Also check if the scale requires a “request” if it only sends data on demand. If the scale has a “print” button, try pressing it.

If you can still not receive any data, attempt using another terminal emulator (e.g. HyperTerminal) to ensure the device is sending data.

Receive Terminator

Once the handshake settings are correct, you will see data received in the monitor.

Most devices mark the end of the data string transmitted with a terminator.

In this case, it is the last character received, and is ASCII code 13 which corresponds to a CR.

If the device sends multiple termination characters, e.g. CR then LF, then use the second terminator , e.g. in this example LF

Close the serial monitor, and go to the Receiving tab.

Tick the “Terminator” checkbox, and select the “Terminator” from the drop down list.

Set the figure in “Terminate input after” to zero.

At this stage, set the “Min number of reads to 1”.
Set the “Max number of reads” to 3.

Tick the boxes for “Remove control characters” & “Flush port before reading”.

Tick the box “Ignore blank input”.

Test the terminator settings

Click on the menu option “Test” to display the port monitor.

Click on “Simulate” to check for incoming data.

You should see the string being transmitted from the device displayed (with little pause as the read will complete as soon as the terminator is received.

If you repeatedly click “Simulate”, you may notice that sometimes the received data is cut-off.

This can be caused if the device is continuously transmitting data, when the PCs serial port is opened, the device may be half way through transmitting a data string.

Close the serial port monitor, and return to the “Receiving” tab.

Increase the “Min number of reads” to 2.

This forces ERP-Scale to skip the first terminator, and take the data string leading up to the second terminator, which should always be a complete data string.

Click on “Test” to return to the serial port monitor.

Repeated clicks of the “Simulate” button should now always give the same response.

Close the monitor and the port settings dialogs and save your settings.

Was this article helpful?
Dislike 0
Views: 21
© Copyright - Pocket Programs