B&B Electronics 232SDD16 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) -

 

MS Byte

 

LS Byte

Shown in binary -

10000001

00000011

Shown in decimal -

129

3

 

(128+1)

(2+1)

Shown in hexadecimal -

81

3

 

(80h+1h)

 

(2h+1h)

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

 

MS Byte

 

LS Byte

Shown in binary -

11001000

01010010

Shown in decimal -

200

82

 

(128+64+8)

(64+16+2)

Shown in hexadecimal -

C8

52

 

(80h+40h+8h)

 

(40h+10h+2h)

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

232SDD16-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: !0RD

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: 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.

12

232SDD16-1005 Manual

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

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

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

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

Image 8
Contents Internet Electronics Mfg. Co. IncDesigned and Manufactured Ottawa, Illinois Table of Contents 232SDD16-1005 Manual 232SDD16 FeaturesIntroduction Size 232SDD16 SpecificationsCommunications Connections Digital I/O Connections232SDD16 I/O Port Pinout Serial Port ConnectionsRS-232 Connector Pinout Power Supply Connections232SDD16 To DTE Connections 232SDD16 To DCE ConnectionsCommands 232SDD16 CommandsEquivalent Values SyntaxBit Assignments for I/O Lines Read I/O Lines CommandSet Output Lines Command Read Configuration Command Define I/O Lines CommandSet Power-up States Command Bin. Example !0RC01010101010000010101000001000000 Interfacing Digital InputsIsolated Solid State Input Digital 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 CommandMSdefs = MSdefs or mask LSdefs = LSdefs or mask MSdefs = MSdefs and NOTmask LSdefs = LSdefs and NOTmaskDemonstration Program Running Demonstration ProgramAppendix a Appendix B Decimal to Hexadecimal Conversion Figure C.1 DTB25 Outline Drawing 232SDD16-1005 Manual Appendix CTable C.1 DTB25 Connections Table C.2 DBM16 I/O ConnectionsFigure C.2 DBM16 Outline Drawing DBM16 InterfacingFigure C.6 Isolated Solid State Input Outputs DBM16 Specifications LinesInputs 232SDD16-1005 Manual Appendix C #0RD Msb~ I/O msbI/O lsb ~ I/O lsb00FF01FE Comp = not x and &HFFTable D-1 Extended Commands 232SDD16-1005 Manual Appendix D