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

Models: 485SDD16

1 28
Download 28 pages 11.04 Kb
Page 8
Image 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

Page 8
Image 8
B&B Electronics 485SDD16 manual Bit Assignments for I/O Lines, Read I/O Lines Command, Set Output Lines Command