|
|
Printer friendly version |
|
Serial port
setup |
|
|
|
Every serial device has a different
setup, the main settings are:
- Baud rate
- Handshake
- Data & stop bits
- Parity
Also some devices transmit the data
continously, where as others require a request string to be send before it will
respond with the current data.
This guide will attempt to assist
you with finding the correct serial port settings in SapScale for your device.
It assumes that the device is using
continous send (constant mode), and you already know the baud rate, parity, data
& stop bit settings.
You will need the latest version
of SapScale (V2.0.5 or higher)
|
|
|
|
|
1. Serial Port Settings |
|
First add a new device (see section 6.2 of the handbook) |
|
|
|
|
1a. 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" |
 |
|
1b. 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 after to 30 chars.
Also set a high timeout to ensure we get a good sample of data. |
 |
|
1c. Add the Requesting settings |
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 checkbox is not ticked.
|
 |
|
2. 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. |
 |
|
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.
If you can still not receive any data, attempt using another terminal emulator (e.g.
HyperTerminal) to ensure the device is sending data.
|
 |
|
4. 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 dropdown 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". |
 |
|
5. 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 continously transmitting data, when the PCs
sserial 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 SapScale 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.
You can now proceed with the data parsing setup (see section 8 of the handbook). |
|