B&B Electronics manual 232DRIO Commands, Equivalent Values, Syntax, Function Command Response

Page 12

Table 3.1 – 232DRIO Commands

Function

Command

 

Response

Set Output Lines

!0S{…}

 

No response

Read I/O Lines

!0R

 

{…}

Set Output Lines

#0S{…}{~…}

 

No response

Read I/O Lines

#0R

 

{…}{~…}

Symbol: {…}

represents one byte

 

<…> represents a numeric value

~complement of the specified data byte

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: “!0R”. 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 an additional data byte 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.

Table 3.2 – Equivalent Values

ASCII

Decimal

Hexadecimal

!

33

21h

#

35

23h

0

48

30h

R

82

52h

S

83

53h

Syntax

Command strings consists of three to five bytes depending on commands used for normal or harsh environments. The first byte is always the start of message byte. The start of message byte is either the ASCII “!” character (normal) or the ASCII “#” character (harsh). The second byte is the address byte. This byte allows each unit to have a unique address (useful in RS-485 networks). Since the 232DRIO uses RS-232 communications, this byte is always the ASCII “0” character and can not be changed. The next byte is the command character. This byte is ASCII character and

10

232DRIO-0308 Manual

B&B Electronics --

PO Box 1040 -- Ottawa, IL 61350

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

Image 12
Contents Model 232DRIO Electronics Mfg. Co. IncDesigned and Manufactured Ottawa, Illinois InternetPage Table of Contents Table of Contents 232DRIO-0308 Manual Appendix B232DRIO Features Introduction232DRIO Specifications Non-polarized, Optically Isolated Input 232DRIO-0308 ManualPower Supply Relay OutputsCommunications EnvironmentConnections Opto-isolated Input black terminal blocksRelay Outputs blue terminal blocks GroundRS232 Connector Pinout 232DRIO Terminal BlocksSerial Port Connections Power Supply Connections 232DRIO To DTE Connections232DRIO To DCE Connections #0R 01FEComp = not x and &HFF 232DRIO Commands Function Command ResponseEquivalent Values SyntaxBit Assignments for I/O Lines Data BytesExample Set Output Lines Data Byte Relays Binary Decimal Relay #2 Relay #1Input #1 Relay #2 Relay #1 Read I/O Lines Command Set Output Lines Command0R00000000 Shown in bold faceArgument … shown in bold face 0S030S00000011 …~… shown in bold faceBoard Layout Opto-isolated Input Switch Input Isolated Mechanical Input Relay Outputs 232DRIO External Circuit Symbol Digital I/O Mask ValuesOpening a COM Port Closing a COM PortUsing the 232DRIO.LIB with QuickBasic Read I/O States CommandSet Output States Command QuickBasic DEMO232.EXE and DEMO232.BAS++ DEMO232.EXE and DEMO232.CPP #include232DRIO.H void mainRunning Demonstration Program QuickBasicAppendix a Appendix a 232DRIO-0308 Manual Decimal to HEX to Ascii Conversion TableAppendix B Decimal to Hexadecimal Conversion Appendix B 232DRIO-0308 Manual