B&B Electronics 232DRIO manual Example Set Output Lines Data Byte Relays Binary Decimal

Page 14

Example 3.1

Set Output Lines

 

 

Data Byte

 

Relays

 

Binary

Decimal

Hex

Relay #2

Relay #1

XXXXXX00

 

0

0

de-energized

de-energized

XXXXXX01

 

1

1

de-energized

energized

XXXXXX10

 

2

2

energized

de-energized

XXXXXX11

 

3

3

energized

energized

Symbol: X don’t cares (default setting should all be “0”)

To energize the relays, the corresponding bit of the data byte must be set high. Conversely, to de-energize the relays the corresponding bit of the data byte must be set low.

(00000011, 3 in decimal, 3 in hex: energized both relay #1 and #2)

Example 3.2

Read I/O Lines

 

 

Data Byte Returned

 

Status

 

Binary

Dec

Hex

ASCII

Input #1

Relay #2

Relay #1

00000000

0

00

NUL

low

de-energ.

de-energ.

00000001

1

01

SOH

low

de-energ.

energ.

00000010

2

02

STX

low

energ.

de-energ.

00000011

3

03

ETX

low

energ.

energ.

00000100

4

04

EOT

high

de-energ.

de-energ.

00000101

5

05

ENQ

high

de-energ.

energ.

00000110

6

06

ACK

high

energ.

de-energ.

00000111

7

07

BEL

high

energ.

energ.

Notice that the returned data byte starts at address 00000000 in binary, 0 in dec., 0 in hex., or NUL in ASCII. From left to right (msb to lsb), the first five bits are really XXXXX “don’t cares” but are defaulted as “00000”. The remaining three bits represent input #1, relay #2, and relay#1, respectively. A “1” or a HIGH represents relay energized/input present, and a “0” or a LOW represents relay de- energized/input absent.

12

232DRIO-0308 Manual

B&B Electronics --

PO Box 1040 -- Ottawa, IL 61350

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

Image 14
Contents Designed and Manufactured Ottawa, Illinois Model 232DRIOElectronics Mfg. Co. Inc InternetPage Table of Contents Table of Contents 232DRIO-0308 Manual Appendix B232DRIO Features Introduction232DRIO Specifications Non-polarized, Optically Isolated Input 232DRIO-0308 ManualCommunications Power SupplyRelay Outputs EnvironmentRelay Outputs blue terminal blocks ConnectionsOpto-isolated Input black terminal blocks GroundSerial Port Connections RS232 Connector Pinout232DRIO Terminal Blocks 232DRIO To DCE Connections Power Supply Connections232DRIO To DTE Connections Comp = not x and &HFF #0R01FE Equivalent Values 232DRIO CommandsFunction Command Response SyntaxBit Assignments for I/O Lines Data BytesInput #1 Relay #2 Relay #1 Example Set Output Lines Data Byte Relays Binary DecimalRelay #2 Relay #1 0R00000000 Read I/O Lines CommandSet Output Lines Command Shown in bold face0S00000011 Argument … shown in bold face0S03 …~… shown in bold faceBoard Layout Opto-isolated Input Switch Input Isolated Mechanical Input Relay Outputs 232DRIO External Circuit Opening a COM Port SymbolDigital I/O Mask Values Closing a COM PortSet Output States Command Using the 232DRIO.LIB with QuickBasicRead I/O 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