B&B Electronics manual 485SDD16 Commands, Equivalent Values, Syntax, Data Bytes

Page 7

Chapter 3 - Commands

There are only two commands required to control the 485SDD16: set output lines, and read I/O lines. Five additional commands are used for configuring the module: set module address, set turn- around delay, define I/O lines, set power-up states, and read configuration. Command strings are from four to six bytes in length: the “!” character, an address byte, two command characters, and one or two data bytes (if required). (See Table 3.1).

Table 3.1 - 485SDD16 Commands

Function

 

Command

Response

 

 

 

 

Read I/O Lines

 

!{addr}RD

{I/O msb}{I/O lsb}

Set Output Lines

 

!{addr}SO{I/O msb}{I/O

no response

 

 

lsb}

 

Set Module Address

 

!{addr}SA{new adr}

no response

Set Turn-around

 

!{addr}SC{#}

no response

Delay

 

 

 

Define I/O Lines

 

!{addr}SD{I/O msb}{I/O lsb}

no response

Set Power-up States

 

!{addr}SS{I/O msb}{I/O lsb}

no response

 

 

 

I/O Definitions

Read Configuration

 

!{addr}RC

{I/O msb}{I/O lsb}

 

 

 

Power-up States

 

 

 

{I/O msb}{I/O msb}

 

 

 

RS-485 Config.

 

 

 

{addr}{t-a delay}

Symbols: {...} represents one byte

 

 

<...> represents a numeric value

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 the Read I/O command contains the following ASCII characters: “!" and "RD”. 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 numeric 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 additional data bytes to complete the command. These data bytes may be represented in any of the formats list above. Refer to Appendix A for more ASCII and decimal equivalents.

485SDD16-1005 Manual

9

B&B Electronics --

707 Dayton Road -- Ottawa, IL 61350

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

Table 3.2 - Equivalent Values

ASCII

Decimal

Hexadecimal

 

 

 

!

33

21h

0

48

30h

A

65

41h

C

67

43h

D

68

44h

O

79

4Fh

R

82

52h

S

83

53h

Syntax

Command strings consist of four to six bytes. The first byte is the start of message byte. The start of message byte is always the ASCII “!” character. The second byte is the address byte. This byte allows each unit to have a unique address. The factory default address is the ASCII "0" character. The next two bytes are the command characters. These bytes are ASCII characters and used to specify which command will be executed by the module. Some commands require an argument field containing a fifth and sometimes a sixth data byte. Commands that manipulate I/O lines require two data bytes, a Most Significant and a Least Significant data byte respectively.

Command Syntax: !

0

_

_

_

_

6th Data Byte

5th Data Byte

2nd Command Byte

1stCommand Byte

Address Byte

 

 

Start of Message Byte

I/O Data Bytes

When constructing commands to manipulate output lines or when reading the state of the I/O lines it is necessary to know how to select and interpret the I/O data bytes. The sixteen I/O lines are represented by two data bytes. The Most Significant data byte represents I/O lines #15 through #8 and the Least Significant data byte represents I/O lines #7 through #0. The Most Significant byte is always sent and received first followed by the Least Significant byte.

10485SDD16-1005 Manual

B&B Electronics -- 707 Dayton Road -- Ottawa, IL 61350

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

Image 7
Contents Sales@bb-elec.com Support@bb-elec.com Electronics Mfg. Co. IncDesigned and Manufactured Ottawa, Illinois InternetTable of Contents 485SDD16 Specifications 485SDD16 FeaturesIntroduction Communications Power SupplySize Serial Port Connections ConnectionsDigital I/O Connections 485SDD16 I/O Port PinoutExample of Multi-Node Network Syntax Commands485SDD16 Commands Equivalent ValuesSet Output Lines Command Read I/O Lines CommandBit Assignments for I/O Lines Command AddrSC Argument Set Module Address CommandSet Turn-around Delay Command Define I/O Lines CommandCommand AddrRC Argument None Response Set Power-up States CommandRead Configuration Command Read Configuration command returns the modules I/ODigital Inputs InterfacingDigital Outputs Isolated Solid State InputProgramming Techniques SoftwareDigital I/O Mask Values MSstates = MSstates or mask LSstates = LSstates or mask Set Output States CommandMSdefs = MSdefs and mask LSdefs = LSdefs and mask MSpups = MSpups and mask LSpups = LSpups and maskMaddr = Define I/O Lines CommandSet Power-up States Command Cmnd$ = ! + CHR$Maddr + SO + CHR$MSstates + CHR$LSstatesLSpups = LSpups or &H20 Set Module Address CommandMSpups = MSpups and NOTmask LSpups = LSpups and NOTmask Cmnd$ = ! + CHR$Maddr + SS + CHR$MSpups + CHR$LSpupsRunning Demonstration Program Demonstration Program485SDD16-1005 Manual Appendix a Decimal485SDD16-1005 Manual Appendix a 119 120 121 122 123 124 125 126 127485SDD16-1005 Manual Appendix B Appendix B240 4th Hex digit Decimal equals 10FC hexadecimal Decimal to Hexadecimal Conversion252 3rd Hex digitAppendix C Table C.2 DBM16 I/O Connections Table C.1 DTB25 ConnectionsDBM16 Interfacing 485SDD16-1005 Manual Appendix C Figure C.4 Solid State InputConnections Size DBM16 Specifications LinesPower Supply Input Voltage TotalFigure C.10 DBM16 Schematic Comp = not x and &HFF #addrRDMsb~ I/O msbI/O lsb ~ I/O lsb 00FF01FE485SDD16-1005 Manual Appendix D Table D-1 Extended Commands