CDN36X User Manual
revision 1.30
Serial Transmit Example
The following example shows how the CDN36X gateway receives DeviceNet output data,
converts the data into an ASCII string, then builds and transmits a serial message using the
converted string.
The gateway receives an I/O Command Message from the DeviceNet master. The first byte in
the I/O Command data field contains the
Transmit Toggle
bits for
Serial Transmit Object
instances 1-8. The second byte contains the
Receive Acknowledge
bits for
Serial Receive Object
instances 1-8. The remaining data bytes are the
Transmit Data
for the enabled
Serial Transmit
Object
instances. In this I/O Command,
Serial Transmit Object
Instance 1 receives a toggled
Transmit Toggle
bit, indicating the application has sent a new
Transmit Data
value to Instance 1.
Serial Transmit Object
Instance 1 is configured for SINT
Data Type
, with
Width
of 2 and
Conversion
set for decimal with no leading zeros. Instance 1 converts its new
Transmit Data
value 0x52 into the ASCII string ‘82’. The Instance’s
Transmit
Mode
attribute is set for
String1
Before, Data,
and
String2 After
. The resulting serial message that gets loaded into the gateway
transmit buffer consists of [String1, ‘82’, String2]. The message will be sent when the serial
channel transmitter is available.
When the new message is loaded in the transmit buffer, Instance 1 toggles its
Transmit
Acknowledge
bit, indicating that is it ready to receive the next
Transmit Data
value. The updated
Transmit Acknowledge
bit is sent to the application in the next DeviceNet I/O Response
Message. There may have been subsequent DeviceNet I/O message transactions in between the
time Instance 1 received the new
Transmit
Data
value and the time it toggles its
Transmit
Acknowledge
bit.
Serial Transmit Process
STX ‘SET T = 82 C’ CR ETX
I/O RESPONSE MESSAGE
I/O COMMAND MESSAGE
DeviceNet
Master
CDN36X
Gateway
Serial
Device
1)
Transmit Data
received from DeviceNet master.
I/O COMMAND MESSAGE
TT=0000000
1
RA
0x52
STO4 Data STO7 Data
TT = Transmit Toggle bits (Instance 1 bit toggled 0-1)
RA = Receive Acknowledge bits
0x52 = Instance 1 Transmit Data
2)
Serial Transmit Object
Instance 1 converts data to ASCII.
Data Type = SINT, Width = 2, Conversion = D
0x52
0x52 hex
Æ
82 decimal
Æ
‘82’ or [ 0x38 0x32 ]
0x38
0x32
3) Instance 1 builds message & loads into transmit buffer.
String1 = [0x09 0x02 ‘SET T = ‘]
0x02 0x53 0x45 0x54 0x20 0x54 0x20 0x3D 0x20 0x38 0x32 0x20 0x43 0x0D 0x03
Data = [ ‘82’ ]
String2 = [0x04 ‘ C’ 0x0D 0x03]
4) Gateway transmits message.
Serial Data Stream (hex bytes)
0x02 0x53 0x45 0x54 0x20 0x54 0x20 0x3D 0x20 0x38 0x32 0x20 0x43 0x0D 0x03
Serial Data Stream (ASCII)
<STX> S E T <SP> T <SP> = <SP> 8 2 <SP> C <CR> <ETX>
MKS Instruments, Inc.
D.I.P. Products Group
24