PLX3x Series ♦ Multi-Protocol Gateways
ASCII Protocol
User Manual
ProSoft Technology, Inc.
Page 137 of 215
January 25, 2018
In both receive and transmit operations, the driver requires a signal to determine
when new data is received or must be transmitted. The first word in the two data
area is used for this purpose. When the value of the first word changes, new data
is available.
Here is a receive example.
1
The sequence number in the receive data block has a value of 0 (set when
the module initializes).
2
The ASCII device sends a new data packet and the termination condition is
present.
3
The receive driver copies the data into the internal data area, sets the
message length in the data area, and finally, sets the new sequence number.
Receive Data
The gateway places data from the receive driver in the module’s internal
database in a fixed format at the location that you define in ProSoft Configuration
Builder (PCB). The receiver driver is disabled if you set the receive database
start location to a value of -1 when you configure the gateway in PCB. The
following table shows the structure of the received data.
Word Offset
Description
0
Receive sequence number. This register is incremented by the Module’s Receive
Driver for each new packet received.
1
Number of characters transmitted (0 to 255) from last transmit request.
2
Number of characters (0 to 256) in receive block (3 to 130).
3 to 130
Received data on port.
The first word of the data block signals that new receive data is available.
Word 1 of the block contains the number of bytes in the last message
transmitted on the port.
Word 2 contains the number of bytes in the received message data area.
Words 3 to 130 contain the data received.
Swapping data bytes
If you configure the module to swap the data bytes, the receive driver swaps the
bytes in each word before placing the data into the data block. Because the data
received may contain an odd number of bytes, the driver increases the length of
the message by 1 when the data has an odd number of bytes when using the the
swap option. This avoids losing the last byte of data in the message.