Chapter 3 - Commands; Syntax; I/O Data Bytes - B&B Electronics RS-232 Digital I/O Module 232SDD16 User Manual

Rs-232 digital i/o module
Table of Contents

Advertisement

Chapter 3 - Commands

There are only two commands required to control the 232SDD16:
set output lines, and read I/O lines. Three additional commands are
used for configuring the module: define I/O lines, set power-up
states, and read configuration. Command strings are from four to
six bytes in length; the "!" character, the "0" (zero) character, two
command characters, and one or two data bytes, if required. (See
Table 3.1).
Table 3.1 - 232SDD16 Commands
Function
Command
Set Output Lines
!0SO{I/O msb}{I/O lsb}
Read I/O Lines
!0RD
Define I/O Lines
!0SD{I/O msb}{I/O lsb}
Set Power-up States !0SS{I/O msb}{I/O lsb}
Read Configuration
!0RC
Symbols: {...} represents one byte
<...> represents a numeric value
Before going into the specifics of each command, it is important
to understand that a byte has a numeric value from 0 to 255. The
byte's value can be represented in decimal (0 -255) format,
hexadecimal (00 - FF) format, binary (00000000 - 11111111) format
or as an ASCII character. The fixed bytes of each command will be
represented as ASCII characters, for example: "!0RD". Refer to
Table 3.1. However, it is important to remember that an ASCII
character has a numeric value. Example: the ASCII "0" (zero) does
not have a value of zero but has a value of 48. The decimal and
hexadecimal equivalents of some ASCII characters are shown in
Table 3.2. Some commands require additional data bytes to
complete the command. These data bytes may be represented in
any of the formats listed above. Refer to Appendix A for more ASCII
and decimal equivalents.
232SDD16-1005 Manual
B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Response
no response
{I/O msb}{I/O lsb}
no response
no response
I/O Definitions
{I/O msb}{I/O lsb}
Power-up States
{I/O msb}{I/O msb}
9
Table 3.2 - Equivalent Values
ASCII
Decimal
!
33
0
48
C
67
D
68
O
79
R
82
S
83

Syntax

Command strings consists of four to six bytes. The first byte is
the start of message byte. The start of message byte is always the
ASCII "!" character. The second byte is the address byte. This byte
allows each unit to have a unique address (useful in RS-485
networks). Since the 232SDD16 uses RS-232 communications, this
byte is always the ASCII "0" character and can not be changed. The
next two bytes are the command characters. These bytes are ASCII
characters and used to specify which command will be executed by
the module. Some commands require an argument field. This field
contains the fifth and sixth data byte, a Most Significant and a Least
Significant data byte respectively.
Command Syntax: !
0
_
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1st Command Byte
|
Address Byte
Start of Message Byte

I/O Data Bytes

When constructing commands to manipulate outputs lines or
when reading the state of the I/O lines it is necessary to know how
to select and interpret the I/O data bytes. The sixteen I/O lines are
represented by two data bytes. The Most Significant data byte
represents I/O lines #15 through #8 and the Least Significant data
byte represents I/O lines #7 through #0. The Most Significant byte is
always sent and received first followed by the Least Significant byte.
10
B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350
PH (815) 433-5100 -- FAX (815) 433-5104
Hexadecimal
21h
30h
43h
44h
4Fh
52h
53h
_
_
_
|
|
|
|
|
6th Data Byte
|
5th Data Byte
2nd Command Byte
232SDD16-1005 Manual

Advertisement

Table of Contents
loading

Table of Contents