Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 8 of 11

Model 10 Bar Code Scanner Operations and Maintenance Manual, pages 71 to 80

Pages 71 to 80 of 102

The original document is the PDF (6.5 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Accu-Sort Model 10

Page 71

Appendix A ASCII Communications

AHeading 2

Appendix A

Contents

ASCII COMMUNICATIONS..........................................................................A-3 STANDARD RS485 MULTIDROP COMMUNICATIONS ................................A-3 MESSAGE FORMATS ..............................................................................A-4 MESSAGE SEQUENCING ........................................................................A-5 TIMING ..................................................................................................A-5 MULTIDROP PROTOCOL EXAMPLES........................................................A-7 PROTOCOLS USED WITH RS232, CURRENT LOOP, AND 422 ..................A-8 ASCII CHART ...........................................................................................A-9

Page 72

A-2

Accu-Sort Systems

MODEL 10 OPERATIONS AND MAINTENANCE MANUAL

Page 73

ASCII COMMUNICATIONS

A-3

ASCII COMMUNICATIONS STANDARD RS485 MULTIDROP COMMUNICATIONS RS485 communications is an Engineering Industries Association standard for the transmitters and receivers of a digital equipment interface. RS485 communication uses differential signal lines and allows for multiple transmitters on one signal pair (although only one transmitter may be enabled at any given time). This is a way of allowing one device to communicate with one or more other devices using the Master/Slave method. The Master/Slave system works as follows: The master device (usually a decoder logic or computer) originates poll messages. The poll message is a message from the master to a slave requesting the slave to respond with data (if data is available). The slave is usually a bar code scanner. The slave device responds to the polls from the master. It is not allowed to transmit unless it has been “asked” (polled) by the master. Shown below is a simplified drawing of one way that RS485 communications works: This representation shows one Master and six slaves. You can ultimately have up to 32 slaves for each serial port on the master (depending on the line length and required response time).

RS485 Communications Example

The remainder of this section defines the message formats and timing requirements for the protocol used on RS485 multidrop (2-wire) communications lines. The protocol is defined for both the “master” device and the “slave” devices. This protocol is defined for a one-master system only. The following definitions may help you understand this protocol a little better. ASCII digit HEX digit

This means the ASCII code for a single decimal digit. For example, 30h is the ASCII digit that encodes a zero. This means the ASCII code for a single hexadecimal digit. Some examples are, 35h is the code for a five, 42h is the code for a "B" (which equals 11 base 10), the hexadecimal number "5A" would be encoded by the two HEX digits 35h and 41h.

Solutions with Vision

Page 74

A-4

MODEL 10 OPERATIONS AND MAINTENANCE MANUAL

MESSAGE FORMATS The standard communications parameters are as follows: Standard asynchronous data frame (least significant bit first) 7 data bits 1 even parity bit 2 stop bits

If the master can only support 8 bit data plus a parity bit, the format is as follows: 8 data bits 1 odd parity bit 1 stop bit

(Odd parity is required to make sure that the guard character will be all ones with one for parity.) You can use any baud rate that is supported by both the master and the slaves. System performance is usually best when using the highest baud rate possible. The following is framing for all messages sent by any device on the multidrop line: 0FFH (FFhex) = Guard Character STX(02hex) = Start of text character ID(2 ASCII digits) = The unit ID

TYPE(2 ASCII digits) = The message type Message Types 01 02

STX ID(2) TYPE(2)

SEQ DATA LRC(2)

CR

This character is "sacrificed" to the line noise that occurs when the unit transmitter is first turned on. The unit software may (optionally) wait one character time between transmitter enable and transmission of the STX (the next character). This eliminates transmitting the guard character. The receiver ignores this character. This character indicates the start of a message. The receiver should clear any characters in its receive buffer whenever it receives this character. This field indicates the unit identification number of the unit to which the message is directed, if the message is coming from the master. This field indicates the unit identification number of the unit transmitting the message, if the message is from a slave. A message with an ID of "00" from the master is a broadcast message. All slave units should act on the message (display data, reset, etc.), but no slave should respond to the message. This field describes the purpose of the message that is sent. There are five message types as shown below:

Poll Data

This message type is sent by the master unit to request data from a slave. This message type is sent by either a master to transfer data to a slave or by a slave to transfer data to the master after receiving a poll. The TYPE field will then be followed by a SEQ field and a data field. 03 ACK This message type is sent by the unit that has just received a valid data message. 04 Wake up This message type is sent by the master. The slave that receives it should acknowledge the message. 05 No data This message type may be sent by a slave indicating that the slave has no data to send in response to a poll. This message is optional. If the slave has no data, it may ignore the poll. This field starts at zero at power up, and is incremented by one for each data message sent. When SEQ(1 ASCII digit) = The sequence number the sequence number reaches nine, it wraps around to one. This field is only present in a data message. This field contains data, if the message type indicates that data is included. This field may contain DATA = no characters (length of zero; poll, acknowledge and wake up messages do not have data fields.) The content of the data field LRC(2 HEX digits) = The Linear Redundancy Check Sequence CR (0Dh) = Carriage return

Accu-Sort Systems

The LRC is computed by exclusive-oring all the characters in the ID, TYPE, SEQ, and data fields, then converting the hex number into two ascii digits. This mathematical process checks to make sure that the message is valid. This character indicates the end of the message. When this character is received, the unit should check to see that the message started with a STX, and check that the LRC is correct before accepting it as a valid message.

Page 75

ASCII COMMUNICATIONS

A-5

MESSAGE SEQUENCING The master unit initiates all data transfers by either sending data to a slave or requesting data from a slave. This protocol is strictly half duplex; only one device may be transmitting at any time. A slave device should not transmit unless it receives a valid message that requires a response--when it does receive such a message, it must respond quickly (See Timing). The master unit should respond in a timely manner, but is not under the same constraints as a slave. The following is an example of processing a Master/Slave interaction. 1. 2. 3. 4. 5.

Master

Slave’s response

Master’s response

Wake up Poll Poll Poll Data

ACK Data No data -noneACK

-noneACK -none-none-none-

TIMING If a slave unit is going to respond to a poll from the master, it must start its response within two character times of the end of the carriage return at the end of the poll. This makes the response time dependent upon the baud rate.

The slave must turn on its transmitter within two character times after receiving the CR of the master’s poll. The slave must place the STX at the beginning of its response, into its serial port no later than three character times after receipt of the master’s carriage return. Once the slave begins transmitting, it must not allow a gap of more than one half a character time between characters. Most transmissions will take place under interrupt, so this should not be a problem; however, it means that serial port interrupts may not be disabled for an extended period of time during data transmission.

Master/Slave Timing Diagram

“S” is the start bit, “0123456” are the character bits, “P” is the parity bit and “s” is the stop bit.

Solutions with Vision

Page 76

A-6

MODEL 10 OPERATIONS AND MAINTENANCE MANUAL

Typically, the “RTS” line is used to control the transmitter. In this diagram, “RTS” is high when the transmitter is enabled and low when the transmitter is disabled (“tri-stated”). The slave’s “FF” may be replaced with a one character time (10/baud rate) delay between transmitter turn-on and transmission of the STX.

Time Limits A B C

Maximum Minimum Maximum Minimum Maximum Minimum

2 character times (20/baud rate) 0 4 character times (40/baud rate) 2 character times (due to guard character + STX transmission time) 1/2 character time (5/baud rate) 0

Both the master and the slave must disable their transmitter as soon as possible after transmitting the carriage return at the end of the message. The transmitter must remain enabled while the carriage return is being sent out, however. This means that the transmitting device must wait for a “transmitter empty” (as opposed to a “transmitter ready”) indication from the serial port before disabling the transmitter. This protocol has been designed for a "slow" master to communicate with a "fast" slave. The only time-critical item for the master is for the master to release control of the line immediately after sending a message to a slave. While the slave must respond within a very short time window, there are no such constraints on the master. The master may have any amount of time between messages or between characters within its message. Error Recovery Error Recovery Error Recovery Error Recovery Error Recovery Error Recovery Error Recovery

The slave does not understand a poll message. None. The master will time out, waiting for the slave’s response, then will go on to the next unit. The slave does not understand a data message from the master. The master will retransmit the data message again after timing out while waiting for the acknowledgement. The master does not understand the slave’s acknowledgement of a data message. The master will retransmit the data message after timing out while waiting for the acknowledgement. The slave will acknowledge the retransmitted message and discard it, since the message will have the same sequence number as the last message received. The master does not understand the slave’s data message (response to a poll). The master will time out waiting for the slave’s response, then continue on to the next poll. Since the slave did not receive an acknowledgement for the data message, it will retransmit the same message in response to the next poll. The slave does not understand the master’s acknowledgement of the slave’s data message. The slave will retransmit the same message in response to the next poll. The master will see that it is a duplicate message, acknowledge it, and discard it. The slave does not understand a broadcast message. None. The message will be lost.

The general rules are as follows: 1. Each data message will be acknowledged by the recipient. If a data message is not acknowledged, the transmitter should retransmit it again up to three retries. After the third retry, a communications error message should be displayed and the message discarded (in some systems the message may be recorded in a disk file or on a printer to prevent data loss).

Accu-Sort Systems

Page 77

ASCII COMMUNICATIONS

A-7

2. Each new message will have a new sequence number. If a message is received that has the same message number as the last message received, the recipient should acknowledge the message and then discard it. The sequence number should only be checked for equality to the last sequence number received: there is no requirement that the sequence number must be the next number expected (although in some systems the master will keep track of “out of sequence” errors since they would indicate that messages had been lost). The sequence number zero is a special case, since it indicates that the data message is the first data message sent since the device sending it has powered up. Messages with a sequence number of zero should always be processed as required, regardless of whether or not they are repeated “back to back”. 3. Any message that contains parity errors, LRC errors or an unrecognized message type should be discarded. No acknowledgement should be sent. In some systems, the master will keep track of these transmission errors. 4. Any message that contains a correct LRC, has no errors, is of a correct type, and requires an acknowledgement should be acknowledged even if its sequence number indicates that it is a duplicate message (the sequence number is the same as the last message). If it is a duplicate message, it should be acknowledged then discarded. In some systems, the master will keep track of these duplicate message errors since they would indicate that an acknowledgement had been lost. A broadcast message (one sent to unit “00”) must not be acknowledged. MULTIDROP PROTOCOL EXAMPLES Message framing FFh, 02h, idhigh, idlow, type, seq no, (DEL, STX, ?, ?, ?, ?,

...data..., lrc0, lrc1, 0Dh ?, ?, ?, CR)

The DEL character is used as a guard character to make sure that the transmission line is quiet for one character time before the STX is sent. The sequence number only appears on data messages. The LRC stands for “linear redundancy check” and appears on all messages.

Polling sequence: 1. MUX polls slave at address 01 with the following format: STX, unit id (2 char), 0, 1, lrc (2 char), CR Example: HEX:

STX 02h

0 30h

1 31h

0 30h

1 31h

0 30h

0 30h

CR 0Dh

2. SLAVE answers the poll with the data in the following format: STX, unit id, 0, 2, seq (1 char), ...data..., lrc, CR Example: HEX:

STX 02h

0 30h

1 31h

0 2 30h 32h

1 A B C D E 7 3 31h 41h 42h 43h 44h 45h 37h 33h

CR 0Dh

Solutions with Vision

Page 78

A-8

MODEL 10 OPERATIONS AND MAINTENANCE MANUAL

If no data is available: STX, unit id, 0, 5, lrc, CR Example: HEX:

STX 02h

0 30h

1 31h

0 30h

5 35h

0 30h

4 34h

CR 0Dh

It is normally faster to allow the master to time out (which takes three character times) than to use the "no data" response.

3. MUX acknowledges data in the following format: STX, unit id, 0, 3, lrc, CR Example: HEX:

STX 02h

0 30h

1 31h

0 30h

3 31h

0 30h

2 32h

CR 0Dh

4. MUX polls the next unit . . . PROTOCOLS USED WITH RS232, CURRENT LOOP, AND 422

RTS/CTS (Used with only RS232)

ACK/NAK

XON/XOFF

Accu-Sort Systems

This protocol stands for "Request To Send" and "Clear To Send". This is a common type of "handshaking" that goes on between two units. When one device wants to transmit to another device, it will drive the RTS line indicating it has data to transmit. When the receiving device is ready to receive, it will drive the CTS line indicating it is ready. When you use RTS/CTS it requires the addition of two more wires on the communication cable. If they are not needed then it is advised not to use any other additional lines in the cable. This is a software protocol. When a unit receives a message, it indicates whether it has received that message correctly. If all information is received, the unit will transmit an "ACK" (acknowledge). The ACK is a signal that more information may be transmitted. If the information is not received correctly, then it will transmit a "NAK" (nonacknowledge). The NAK is a signal requesting a message be retransmitted. Most software has a limit to the number of retransmits. Three NAKS is common. This is a software protocol. XON stands for "transmit on" and XOFF stands for "transmit off". A unit receiving data may signal the unit transmitting that it should stop sending data by transmitting and XOFF (ctrl-S). An XON (ctrl-Q) signals the original unit to begin transmitting again.

Page 79

ASCII COMMUNICATIONS

A-9

ASCII CHART DEC

HEX

000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031

00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F

HEXADECIMAL & DECIMAL CHARACTER ASCII TABLE ASCII DEC HEX ASCII DEC HEX ASCII DEC ^@ NUL ^A SOH ^B STX ^C ETX ^D EOT ^E ENQ ^F ACK ^G BEL ^H BS ^I HT ^J LF ^K VT ^L FF ^M CR ^N SO ^O SI ^P DLE ^Q DC1 XON ^R DC2 ^S DC3 XOFF ^T DC4 ^U NAK ^V SYN ^W ETB ^X CAN ^Y EM ^Z SUB ^[ ESC ^\ FS ^] GS ^^ RS ^- US

032 033 034 035 036 037 038 039 040 041 042 043 044 045 046 047 048 049 050 051 052 053 054 055 056 057 058 059 060 061 062 063

20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B 3C 3D 3E 3F

SPC ! " # $ % & ’ ( ) * + , . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ?

064 065 066 067 068 069 070 071 072 073 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095

40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F 50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F

@ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _

096 097 098 099 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

HEX

ASCII

60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F

’ a b c d e f g h I j k l m n o p q r s t u v w x y z { | } ~ DEL

ASCII Chart

Solutions with Vision

Page 80

A-10

Accu-Sort Systems

MODEL 10 OPERATIONS AND MAINTENANCE MANUAL