<< Click to Display Table of Contents >> Connecting the Barcode Scanner Interface to a Serial Port |
![]() ![]() ![]() |
SpecView will read from the Serial port and the sequence of characters is then seen in SpecView as a Text Variable.
The barcode scanner interface reads from the Serial port until a <CR> is received, and then passes that into SpecView as a Text Variable, SpecView does not transmit anything; it just accepts characters from the Serial port and stores them into the Text variable when a <CR> is received. The Strategy controller can be set to watch for any change in the text and then execute the required actions.
Setting up SpecView with a serial port barcode scanner
To use a barcode scanner the Generic BarCode driver must be enabled on the dongle.
From Edit Mode open the Templates List find Generic BarCode and create a Generic BarCode Scanner. Enter the correct COM port that it is connected to. However, any address can be used, such as '0'.
The reason the address is not significant is because it is only possible to connect a single barcode scanner to a given COM port. If further instruments are required then SpecView's Multiport option will need to be enabled on the dongle.
The 'barcode' parameter of that instrument will display the last sequence of characters sent from the COM port with a <CR> after it.
There is NO specific action for failing to read the barcode within SpecView. Some scanners will return the text 'BAD READ' but SpecView will assume that any text terminated with a <CR> is valid.
The case of a timeout will need to be handled appropriately, as there might be an issue with timeout when the text goes back to N/R.
Consider these two different scenarios (A and B below):
A) If the barcodes are guaranteed to be different each time, because they represent a serial number, then it would be best if the last barcode received was shown on the screen without going to N/R after a timeout period.
Therefore, it is necessary to use a high value for the timeout, such as T=10000 (using Setup COM Port from the Options menu) and TTL=10000 (Time To Live) to keep the last value on the screen. Also put the 'raw' value on the screen and use Edit->Dynamic Attributes to change the Scan Rate of the value on the screen to Ultra-High (or at least faster than the barcode is likely to change):
B) If the barcodes could repeat themselves and be the same twice in a row (such as when there are two of the same product at a supermarket checkout), then keeping the barcode on the screen for a long time means that the operator cannot tell the difference between the first item and the second.
In this case the value of T should be short enough so that the values go to N/R between readings, either because they are being counted, or because an event is being triggered (such as a recipe download) on every barcode scanned.
In the case of (B), the Strategy Controller could be used to capture the last known value of the barcode and could store it in a SpecView Text User Variable, in order to retain it on the screen for the operator's reference.