B&B Electronics 232OPSDA manual Reading A/D Channels Command

Page 15

The command syntax for the extended command set is shown below:

Command Syntax: # 0 _

_ _

_

Compliment

Data Byte

2nd

Command Byte

1st Command Byte

Address

Byte

Start

of Message Byte

Reading A/D Channels Command

The Read A/D channels command returns two bytes for each channel read. The two bytes represent the most significant byte (MSB) and least significant byte (LSB) of the reading. The MSB is received first, followed by the LSB. This command requires a data byte. The data byte is used to specify the number of the highest channel to be read. All channels less than this channel will be read as well. For example, if the data byte has a value of 3, then channels 0 to 3 will be read. The highest channel is read first.

Command Syntax

!0RA{#}

Where “{#}” is a byte that specifies the number of the highest channel to be read. See Table 3.3

Response Syntax

{ch(#)MSB}{ch(#)LSB}{ch(#- 1)MSB}...{ch0MSB}{ch0LSB}

The most significant byte of the channel specified is received first. The least significant byte and the lower channels will follow in descending order. “{chxMSB}” and “{chxLSB}” represent the most and least significant bytes of the A/D conversion result.

Documentation Number 232OPSDA1397 Manual

13

B&B Electronics -- PO Box 1040 --

Ottawa, IL 61350

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

Image 15
Contents Electronics Mfg. Co. Inc Designed and Manufactured Ottawa, IllinoisInternet Table of Contents Page Introduction 232OPSDA FeaturesPacking List General Block DiagramSoftware Installation 232OPSDA SpecificationsAnalog to Digital Converter Communications Power SupplyDigital Input Digital OutputTerminal Function Description Block Connections232OPSDA Serial Port Connections Digital I/O Connections232OPSDA Power Supply Connections Commands Syntax Reading A/D Channels Command States Reading Digital I/O CommandSet Digital Output Command 0RDBuffered 0 to 5V A/D Inputs Sampling RateConverter Range Non-buffered 0 to 5VDC A/D Inputs20mA Current Loop A/D Input To 10VDC A/D InputGain = Application Program Interface Syntax C B232OPSDAReadDigitalSee Also B232OPSDASetDigitalOutputReturns DeinitComPort PurposeDeinitComPort Low-Level CommunicationsPort Address Returns See AlsoMSB$ = INPUT$1, #1 LSB$ = INPUT$1, #1 Read A/D CommandCommand$ = !0RA + CHR$channel Print #1, Command$Read Digital I/O Command Status = states and mask Command$ = !0RDReply$ = INPUT$ 1, #1 States = ASCReply$States = states and NOTmask Command$ = !0SO + CHR$statesSet Digital Output State ‘ Set Output High states = states or maskDecimal to HEX to Ascii Conversion Table Appendix a Decimal to Hex to Ascii Conversion