B&B Electronics RS-232 Digital Relay I/O 232DRIO User Manual

Page 11

Advertising
background image

232DRIO-0308 Manual

9

B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350

PH (815) 433-5100 -- FAX (815) 433-5104

There are only two basic commands required to control the

232DRIO: set output lines and read I/O lines. For normal
environments, command strings are from three to four bytes in
length; the “!” character, the “0” (zero) character, one command
character, and one data byte (if required).

With serial communications in a laboratory environment, the

possibility of a communication error occurring is minimal. However,
in a harsh or an industrial environment the possibility increases. A
communication error occurs when a bit transmitted as a “1” is
received as a “0” or vice versa. If the 232DRIO receives a error in
one or more of the first three command characters (“!0X”), the unit
will not execute the command. However, if the 232DRIO receives a
communication error on a data byte (I/O byte for Read Digital
command or state byte for Set Output State command), the
command will be executed since the unit has no way of knowing that
there was an error.

To provide the 232DRIO with a way of detecting errors in the

data fields, an additional set of commands can be used. This set of
commands begins with the “#” (23h) character, instead of the “!”
(21h) character. Refer to Table 3.1. With these commands every
data byte that is transmitted or received is followed by it’s
complement. For example, to read I/O lines:

Command syntax:
#0R
Response syntax:
{DATA}{~DATA}

Where “~” is used to indicate the “complement of.” If DATA has

a reading of 1, the following would be received:

{01}{FE}
Where FEh is the complement of 1. The complement of number

“x” can be calculated in QuickBasic as follows:

comp = (NOT x) AND &HFF








Advertising