B&B Electronics 232OPSDA Reading Digital I/O Command, Set Digital Output Command, 0RD, States

Page 16

Table 3.3 - Read A/D Response

# of Channels Specified

 

Response

 

 

 

 

 

Channels Returned

 

Bytes

decimal

Hex

ASCII

 

(order of response)

 

Returned

 

 

 

 

 

 

0

0

NUL

 

Channel 0

 

2

1

1

SOH

 

Channels 1,0

 

4

2

2

STX

 

Channels 2,1,0

 

6

3

3

ETX

 

Channels 3,2,..,0

 

8

4

4

EOT

 

Channels 4,3,..,0

 

10

5

5

ENQ

 

Channels 5,4,..,0

 

12

NOTE: There are three test channels that can be read: Ref+, Ref-, and Ref+/2. Specify 13 (0Dh) to read Ref+, 12 (0Ch) to read Ref-, and 11 (0Bh) to read Ref+/2.

Reading Digital I/O Command

The Read Digital I/O command returns a byte which represents the state of the digital input and digital output. Bit 0 corresponds to the state of the digital output, and bit 3 corresponds to the state of the digital input. If a bit is a 0 then the digital state of that digital I/O is LOW. If a bit is a 1 then the digital state of the I/O is HIGH. NOTE: Bits 1-2 and 4-7 of the data byte are ignored.

Command Syntax

!0RD

Unit Response

{states}

Where {states} is a byte in which bits 0 corresponds to the current state of the digital output and bit 3 corresponds to the current state of the digital input.

Set Digital Output Command

The Set Digital Output command is used to set the state of the digital output line. This command requires a data byte. The data byte is used to specify the output state. Bits 0 corresponds to the state of the digital output. If bit 0 is a 0 then the output will be set LOW. If bit 0 is a 1 then the output will be set HIGH. NOTE: This command ignores bits 1-7 of the data byte.

Command Syntax

!0SO{states}

Where {states} is a byte in which bit 0 corresponds to the output state of the digital outputs.

Unit Response no response

14Documentation Number 232OPSDA1397 Manual

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

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

Image 16
Contents Designed and Manufactured Ottawa, Illinois Electronics Mfg. Co. IncInternet Table of Contents Page 232OPSDA Features IntroductionGeneral Block Diagram Packing List232OPSDA Specifications Software InstallationAnalog to Digital Converter Power Supply Digital InputDigital Output CommunicationsConnections Terminal Function Description Block232OPSDA Digital I/O Connections Serial Port Connections232OPSDA Power Supply Connections Commands Syntax Reading A/D Channels Command Reading Digital I/O Command Set Digital Output Command0RD StatesSampling Rate Converter RangeNon-buffered 0 to 5VDC A/D Inputs Buffered 0 to 5V A/D InputsTo 10VDC A/D Input 20mA Current Loop A/D InputGain = Application Program Interface B232OPSDAReadDigital Syntax CB232OPSDASetDigitalOutput ReturnsDeinitComPort Purpose See AlsoLow-Level Communications Port AddressReturns See Also DeinitComPortRead A/D Command Command$ = !0RA + CHR$channelPrint #1, Command$ MSB$ = INPUT$1, #1 LSB$ = INPUT$1, #1Read Digital I/O Command Command$ = !0RD Reply$ = INPUT$ 1, #1States = ASCReply$ Status = states and maskCommand$ = !0SO + CHR$states Set Digital Output State‘ Set Output High states = states or mask States = states and NOTmaskAppendix a Decimal to Hex to Ascii Conversion Decimal to HEX to Ascii Conversion Table