|
Bar Code Scanner
The Device profile below is from the Transaction editor and shows the protocol configuration for a Alpha70 Barcode Scanner. The Scanner reads a barcode when
the trigger is pressed and sends the information to the Comm. port of the PC ending with a caradge return and line feed. Since this is a Unsolicited Serial message, a new block was
created (Block_1) in the Transaction Editor along with two tags. Under the Unsolicited Icon on the right, the first step is to create the Read Response entry. Since the incoming
message can be varied in length the Read Response is set to look for stop characters to determine what incoming data is a single message or packet.
In this case the stop characters are 0x0D (carriage return) 0x0A (line feed). This message is then
placed in a read buffer with a pointer set to the first byte of the message. The first tag updated is
the counter tag. This tag simply increment by one with every new message placed in the buffer.
It's used as an identifier when two or more scans are made of the same barcode. This is critical
because the data in the input tag won't change if the incoming string is identical, but you may have more then one read of the same barcode in a row.
The next tag updated is the Input tag. This tag is set to read a string of variable length ending with a 0x0D or carriage return. Once this tag is updated the read buffer is cleared for the next
incoming message.
Download this example project.
|