CDN36X User Manual
revision 1.30
Example 4 – Transmitting Delimited Data
Using the same configuration as Example 3, the CDN366 gateway is configured to print two
specific text messages. For one message, the gateway converts two integer variables and inserts
it into the text. The second message contains no variables, but simply prints a fixed text
message. The two messages are listed below:
Message #1: ‘TEMP = xxx C, xxx F’, <CR>, <LF>
(xxx is value, range of –50 to +400)
Message #2: ‘ALARM’, <CR>, <LF>
Serial Printer
The serial printer’s RS232 channel is set for 300 bps, 7 data bits, even parity, and 2 stop bits. It
uses XON / XOFF software flow control.
CDN366 Gateway
The CDN366 gateway is configured to transmit this RS232 message format. The
Serial Stream
Object
attributes are shown below for this application. The 3rd column lists the address string if
using Set_Attribute_Single commands to write the attribute values.
Serial Stream Object Configuration (Class Code 64 or 0x40)
Attribute
Data
Class / Instance / Attribute / Data
Description
3. Baud Rate
300
0x40 0x01 0x03 0x01 0x2C
300 bps
4. Data Bits
7
0x40 0x01 0x04 0x07
7 data bits
5. Parity
2
0x40 0x01 0x05 0x02
Even parity
6. Stop Bits
2
0x40 0x01 0x06 0x02
2 stop bit
7. Flow Control
1
0x40 0x01 0x07 0x01
XON / XOFF
The next step is to configure the CDN366 gateway to transmit the specific messages. Three
Serial Transmit Object
Instances are used, two for Message #1 (two variables) and one for
Message #2 (one text message).
Serial Transmit Object
Instance 1 is configured to transmit the first part of Message #1 (TEMP =
xxx C, ‘). It receives an integer value from the DeviceNet scanner, converts it to 3 ASCII
characters, builds a message packet, and transmits it. The
Transmit Mode
is
Use String1 Before
Data
,
Use Data
, and
Use String2 After Data
.
String1
is [‘TEMP = ‘]. String2 is [‘ C, ’]. The
Data Type
is INT, to cover the –50 to 400 range. The
Width
is 3, and the
Conversion
is set for
decimal with no leading zeros.
Serial Transmit Object Instance 1 Configuration (Class Code 66 or 0x42)
Attribute
Data
Class / Instance / Attribute / Data
Description
6. Transmit Mode
19
0x42 0x01 0x06 0x13
Use Data, String1 Before, String2 After
7. String1
0x07, ‘TEMP = ‘
0x42 0x01 0x07 0x07 0x54 0x45 0x4D 0x50
0x20 0x3D 0x20
Short String length = 7, ‘TEMP = ‘
8. String2
0x04, ‘ C, ’
0x42 0x01 0x08 0x04 0x20 0x43 0x2C 0x20 Short String length = 4, ‘ C, ’
9. Data Type
195
0x42 0x01 0x09 0xC3
INT (16-bit signed integer)
11. Width
3
0x42 0x01 0x0B 0x03
convert to 3 ASCII bytes
13. Conversion
1
0x42 0x01 0x0D 0x01
represent integer in decimal
15. Data in I/O Command
1
0x42 0x01 0x0F 0x01
enable data in I/O command
MKS Instruments, Inc.
D.I.P. Products Group
88