B&B Electronics 232OPSDA manual Syntax

Page 14

Table 3.2 - Equivalent Values

ASCII

Decimal

Hexadecimal

 

 

 

!

33

21h

#

35

23h

0

48

30h

A

65

41h

D

68

44h

O

79

4Fh

R

82

52h

S

83

53h

NUL

0

0h

SOH

1

1h

STX

2

2h

ETX

3

3h

EOT

4

4h

ENQ

5

5h

ACK

6

6h

BEL

7

7h

Syntax

As mentioned earlier, the command string consists of four bytes. The first byte is the start of message byte. The start of message byte is always the “!” character. The second byte is the address byte. This byte allows each unit to have a unique address (useful in RS-

485networks). Since the 232OPSDA uses RS-232 communications, this byte is the ASCII “0” (zero) character and cannot be changed. The next two bytes are the command characters. These bytes are used to specify which command will be executed by the module. Some commands require a fifth byte, a data byte.

Command Syntax: ! 0 _ _ _

Data Byte

2nd command Byte 1st Command Byte Address Byte Start of Message Byte

12Documentation Number 232OPSDA1397 Manual

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

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

Image 14
Contents Internet Electronics Mfg. Co. IncDesigned and Manufactured Ottawa, Illinois Table of Contents Page 232OPSDA Features IntroductionGeneral Block Diagram Packing ListAnalog to Digital Converter Software Installation232OPSDA Specifications Digital Output Power SupplyDigital Input CommunicationsConnections Terminal Function Description Block232OPSDA Digital I/O Connections Serial Port Connections232OPSDA Power Supply Connections Commands Syntax Reading A/D Channels Command 0RD Reading Digital I/O CommandSet Digital Output Command StatesNon-buffered 0 to 5VDC A/D Inputs Sampling RateConverter Range Buffered 0 to 5V A/D InputsTo 10VDC A/D Input 20mA Current Loop A/D InputGain = Application Program Interface B232OPSDAReadDigital Syntax CDeinitComPort Purpose B232OPSDASetDigitalOutputReturns See AlsoReturns See Also Low-Level CommunicationsPort Address DeinitComPortPrint #1, Command$ Read A/D CommandCommand$ = !0RA + CHR$channel MSB$ = INPUT$1, #1 LSB$ = INPUT$1, #1Read Digital I/O Command States = ASCReply$ Command$ = !0RDReply$ = INPUT$ 1, #1 Status = states and mask‘ Set Output High states = states or mask Command$ = !0SO + CHR$statesSet Digital Output State States = states and NOTmaskAppendix a Decimal to Hex to Ascii Conversion Decimal to HEX to Ascii Conversion Table