CDN36X User Manual
revision 1.30
Serial Receive Example
The following example shows how the CDN36X gateway captures a serial message packet,
processes the packet, converts the data into a number, and returns it as a DeviceNet input value.
The gateway’s
Serial Stream Object
is configured for the
List
delimiter mode, with a one-byte
Pre-Delimiter
string and a two-byte
Post-Delimiter
string. An incoming message must have
matching delimiter strings to be accepted as a valid message packet.
The
Serial Receive Object
Instance 1 has the
Use Pre-String
,
Use
Data
, and
Use Post-String
options selected for its
Receive Mode
. The message packet must have matching
Pre-String
and
Post-String
values before Instance 1 will process the data. The
Data Type
is configured for
SINT, with a
Width
of 2 and
Conversion
set for decimal. The data field’s two-byte ASCII string
represents a decimal number, which Instance 1 converts into an 8-bit signed integer. The
converted number is saved as the instance’s new
Receive Data
value. The instance also toggles
its
Receive Toggle
bit to signal the reception of new data.
When the gateway receives a DeviceNet I/O Command Message, it builds and sends a
DeviceNet I/O Response Message. The
Transmit Acknowledge
bits from
Serial Transmit Object
instances 1-8 are loaded in the first byte. The
Receive Toggle
bits from
Serial Receive Object
instances 1-8 are loaded in the second byte. The
Receive Data
values from all enabled Serial
Receive Object instances are loaded in the rest of the I/O Response data field. The I/O Response
Message is sent to the DeviceNet master, where the data values are stored as DeviceNet inputs.
The user application receives the updated DeviceNet inputs. Program logic recognizes the state
change in the
Serial Receive Object
Instance 1
Receive Toggle
bit, indicating that Instance 1 has
sent new data in the I/O Response Message. To acknowledge that it has read the new data, the
user application toggles the Instance 1
Receive Acknowledge
bit, which gets sent back to the
gateway in the next I/O Command Message. When the
Serial Receive Object
Instance 1 gets the
updated
Receive Acknowledge
bit, it can then process the next incoming serial message.
MKS Instruments, Inc.
D.I.P. Products Group
22