B&B Electronics 485SDD16 manual Bit Assignments for I/O Lines, Read I/O Lines Command

Page 8

A byte represents an eight-bit binary number (11111111), therefore each byte can represent eight I/O lines. Each bit is assigned a bit position and a weight (value). Refer to Table 3.3.

Table 3.3 - Bit Assignments for I/O Lines

 

MOST SIGNIFICANT I/O BYTE

 

 

 

I/O Line #

15

14

13

12

11

 

10

9

8

Bit Position

7

6

5

4

3

 

2

1

0

Hex Weight

80

40

20

10

8

 

4

2

1

Dec. Weight

128

64

32

16

8

 

4

2

1

 

 

 

 

 

LEAST SIGNIFICANT I/O BYTE

 

 

I/O Line #

7

6

5

4

3

 

2

1

0

Bit Position

7

6

5

4

3

 

2

1

0

Hex Weight

80

40

20

10

8

 

4

2

1

Dec. Weight

128

64

32

16

8

 

4

2

1

To set an output to a HIGH state the corresponding bit position must be set to a "1". Conversely to set an output LOW the corresponding bit position must be set to a "0". When reading I/O lines, any bit set to a "0" indicates the corresponding I/O line is in the LOW state and any bit set to a "1" indicates the corresponding I/O line is in the HIGH state.

Example 3.1 - To set outputs 15, 8, 1, and 0 to a HIGH state, and all other outputs to a LOW state (shown in bold face) -

Shown in binary -

MS Byte

 

LS Byte

10000001

 

00000011

Shown in decimal -

129

3

Shown in hexadecimal -

(128+1)

(2+1)

81

3

 

(80h+1h)

 

(2h+1h)

Example 3.2 - Reply from Read I/O command (shown in bold face) -

Shown in binary -

MS Byte

 

LS Byte

11001000

 

01010010

Shown in decimal -

200

82

Shown in hexadecimal -

(128+64+8)

(64+16+2)

C8

52

 

(80h+40h+8h)

 

(40h+10h+2h)

I/O lines #15, 14, 11, 6, 4, 1 are HIGH and all other I/O lines are LOW.

485SDD16-1005 Manual

11

Read I/O Lines Command

The Read I/O Lines command returns two data bytes that reflect the state of the I/O lines. The first data byte contains the most significant I/O lines (15 - 8). The second data byte contains the least significant I/O lines (7 - 0). If a bit is a "0" then the state of that I/O line is LOW. If a bit is a "1" then the state of that I/O line is HIGH.

Command: !{addr}RD

Argument: none

Response: the state of the 16 I/O lines in two 8 bit bytes. (shown in bold face)

ASCII Example: !0RDÈR

Dec. Example: !0RD<200><82>

Hex. Example: !0RD<C8><52>

Bin. Example: !0RD<11001000><01010010>

Description: Read module 0's (decimal 48) I/O lines. The first byte indicates that I/O lines #15, 14, & 11 are HIGH and I/O lines # 13, 12, 10, 9, & 8 are LOW; the second byte indicates that I/O lines # 6, 4, & 1 are HIGH and I/O lines # 7, 5, 3, 2, & 0 are LOW.

Set Output Lines Command

The Set Output Lines command is used to set the states of the output lines. This command requires two data bytes. These data bytes specify the output state of each output line. The first data byte represents the most significant I/O lines (15 - 8). The second data byte represents the least significant I/O lines (7 - 0). If a bit position is set to a "0" then the state of that output line will be set LOW. If a bit position is set to a "1" then the state of that output line will be set HIGH.

NOTE: Refer to the "Define I/O Lines" command to define an I/O line as an output.

Command:

!{addr}SO

Argument:

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

Response:

none

ASCII Example: !0SOUA

Dec. Example: !0SO<85><65>

Hex. Example: !0SO <55><41>

Bin. Example: !0SO<01010101><01000001>

Description: Set module 0's (decimal 48) output lines. The first byte sets output lines #14, 12, 10, & 8 HIGH and output lines #15, 13, 11, & 9 LOW; the second byte sets output lines #6, & 0 HIGH and output lines # 7, 5, 4, 3, 2, & 1 LOW. Note: If any of these lines are defined as inputs the bit settings are ignored.

12

485SDD16-1005 Manual

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

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

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

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

Image 8
Contents Electronics Mfg. Co. Inc Designed and Manufactured Ottawa, IllinoisInternet Sales@bb-elec.com Support@bb-elec.comTable of Contents Introduction 485SDD16 Features485SDD16 Specifications Size Power SupplyCommunications Connections Digital I/O Connections485SDD16 I/O Port Pinout Serial Port ConnectionsExample of Multi-Node Network Commands 485SDD16 CommandsEquivalent Values SyntaxBit Assignments for I/O Lines Read I/O Lines CommandSet Output Lines Command Set Module Address Command Set Turn-around Delay CommandDefine I/O Lines Command Command AddrSC ArgumentSet Power-up States Command Read Configuration CommandRead Configuration command returns the modules I/O Command AddrRC Argument None ResponseInterfacing Digital InputsIsolated Solid State Input Digital OutputsDigital I/O Mask Values SoftwareProgramming Techniques Set Output States Command MSdefs = MSdefs and mask LSdefs = LSdefs and maskMSpups = MSpups and mask LSpups = LSpups and mask MSstates = MSstates or mask LSstates = LSstates or maskDefine I/O Lines Command Set Power-up States CommandCmnd$ = ! + CHR$Maddr + SO + CHR$MSstates + CHR$LSstates Maddr =Set Module Address Command MSpups = MSpups and NOTmask LSpups = LSpups and NOTmaskCmnd$ = ! + CHR$Maddr + SS + CHR$MSpups + CHR$LSpups LSpups = LSpups or &H20Demonstration Program Running Demonstration ProgramDecimal 485SDD16-1005 Manual Appendix a119 120 121 122 123 124 125 126 127 485SDD16-1005 Manual Appendix aAppendix B 485SDD16-1005 Manual Appendix BDecimal to Hexadecimal Conversion 2523rd Hex digit 240 4th Hex digit Decimal equals 10FC hexadecimalAppendix C DBM16 Interfacing Table C.1 DTB25 ConnectionsTable C.2 DBM16 I/O Connections Figure C.4 Solid State Input 485SDD16-1005 Manual Appendix CDBM16 Specifications Lines Power Supply Input VoltageTotal Connections SizeFigure C.10 DBM16 Schematic #addrRD Msb~ I/O msbI/O lsb ~ I/O lsb00FF01FE Comp = not x and &HFFTable D-1 Extended Commands 485SDD16-1005 Manual Appendix D