CDN36X User Manual
revision 1.30
Example 2 – Receiving Delimited Data
Using the same configuration as Example 1, the scanned UPC labels are printed in one of two
formats: [
MODEL xxx A
] and [
SN: xxxxx
]. The first format is a model number, and ‘xxx’
are 3 ASCII characters that represent a number from 1 to 100. The second format is a serial
number, and ‘xxxxx’ are 5 ASCII characters that represent a number from 1 to 60000. The
gateway is configured to read these two specific UPC label formats, convert the ASCII
characters into integers, and return them as DeviceNet inputs.
Barcode Scanner
The barcode scanner’s RS232 channel is set for 9600 bps, 8 data bits, no parity, and 1 stop bit.
When it reads a UPC label, it transmits the following ASCII message format. The message
always begins with the ASCII STX start-of-text (0x02) character, and always ends with the
ASCII ETX end-of-text (0x03) and CR carriage return (0x0D) characters. The barcode data will
consist of a variable number of ASCII characters, depending upon the UPC label being scanned.
[ STX ] [ ‘MODEL xxx A’ ] [ ETX ] [ CR ]
14 bytes ASCII data
[ STX ] [ ‘SN: xxxxx’ ] [ ETX ] [ CR ]
12 bytes ASCII data
CDN366 Gateway
The CDN366 gateway needs to be configured to receive this RS232 message format. The first
step is to determine the
Delimiter Mode
. The barcode scanner still transmits a variable length
message, so
Length Mode
cannot be used.
Timeout Mode
may be used, but without specific
timing information for the barcode scanner’s RS232 channel it may be difficult to derive a
suitable
Packet Timeout
value.
List Mode
is best suited for this application, because the serial
message always begins and ends with the same characters. The
Serial Stream Object
can now be
configured. The following shows the
Serial Stream Object
attribute settings for this application.
The 3rd column lists the address string if using Set_Attribute_Single commands to write the
attribute values. The last two attributes are Short_String data types.
Serial Stream Object Configuration (Class Code 64 or 0x40)
Attribute
Data
Class / Instance / Attribute / Data
Description
3. Baud Rate
9600
0x40 0x01 0x03 0x25 0x80
9600 bps
4. Data Bits
8
0x40 0x01 0x04 0x08
8 data bits
5. Parity
0
0x40 0x01 0x05 0x00
no parity
6. Stop Bits
1
0x40 0x01 0x06 0x01
1 stop bit
7. Flow Control
2
0x40 0x01 0x07 0x02
CTS / RTS
10. Delimiter Mode
1
0x40 0x01 0x0A 0x01
List Mode
11. Pre-Delimiter String
0x01 0x02
0x40 0x01 0x0B 0x01 0x02
Short_String length = 1, STX
12. Post-Delimiter String
0x02 0x03 0x0D
0x40 0x01 0x0C 0x02 0x03 0x0D
Short_String length = 2, ETX CR
The next step is to configure the CDN366 gateway to process the different label formats and
convert the ASCII characters into integer numbers, to be returned to the DeviceNet scanner.
With two different label formats, two Serial Receive Object Instances will be configured.
MKS Instruments, Inc.
D.I.P. Products Group
84