B&B Electronics 232SDD16 User Manual

Size:
472.64 Kb
Download

RS-232Digital I/O Module

Model 232SDD16

Documentation Number 232SDD16-1005

pn#3604-r1

This product

Designed and Manufactured

In Ottawa, Illinois

USA

of domestic and imported parts by

B&B Electronics Mfg. Co. Inc.

707 Dayton Road --P.O. Box 1040--Ottawa, IL 61350 PH (815)433-5100--FAX (815)433-5104

Internet: http://www.bb-elec.com sales@bb-elec.com support@bb.elec.com

1995 B&B Electronics --Revised February 2005

232SDD16-1005Manual Cover Page

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

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

Table of Contents

 

Chapter 1- Introduction ...........................................

1

232SDD16 Features...............................................

1

Packing List ............................................................

2

232SDD16 Specifications .......................................

3

I/O Lines................................................................................

3

Digital Inputs......................................................................

3

Digital Outputs ...................................................................

3

Power Supply ........................................................................

3

Communications ...................................................................

3

Size .......................................................................................

3

Chapter 2 - Connections .........................................

5

Digital I/O Connections...........................................

5

Digital Inputs .........................................................................

5

Digital Outputs.......................................................................

5

Ground ..................................................................................

5

Serial Port Connections ..........................................

6

Power Supply Connections.....................................

8

Chapter 3 - Commands ...........................................

9

Syntax ..................................................................

10

I/O Data Bytes.....................................................................

10

Read I/O Lines Command ....................................

12

Set Output Lines Command .................................

12

Define I/O Lines Command ..................................

13

Set Power-upStates Command ...........................

14

Read Configuration Command .............................

14

Chapter 4 - I/O Interfacing.....................................

17

Digital Inputs.........................................................

17

Digital Outputs ......................................................

19

232SDD16-1005Manual Table of Contents i

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

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

Chapter 5 - Software..............................................

 

21

Programming Techniques.....................................

 

21

Read I/O States Command.................................................

 

21

Read Configuration Command ...........................................

22

Set Output States Command

..............................................

24

Define I/O Lines Command.................................................

 

25

Set Power-upStates Command .........................................

25

Demonstration Program .......................................

 

27

Hard Drive Installation..........

Error! Bookmark not defined.

Running Demonstration Program .......................................

27

APPENDIX A..........................................................

 

A-1

ASCII Character Codes .......................................

 

A-1

APPENDIX B..........................................................

 

B-1

Hexadecimal/Decimal Conversions .....................

B-1

APPENDIX C..........................................................

 

C-1

Interface Modules for SDD16 Models..................

C-1

DTB25 .................................................................

 

C-2

DBM16 ................................................................

 

C-4

DBM16 Interfacing ............................................................

 

C-5

Inputs .............................................................................

 

C-5

Outputs ..........................................................................

 

C-7

DBM16 Specifications.......................................................

 

C-9

I/O Lines ........................................................................

 

C-9

Inputs.................................................................................

 

C-9

Outputs..............................................................................

 

C-9

Power Supply ................................................................

 

C-9

Size................................................................................

 

C-9

APPENDIX D.......................................................

 

D-1

Adding Data Field Confirmation...........................

D-1

ii Table of Contents 232SDD16-1005Manual

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

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

Chapter 1- Introduction

232SDD16 Features

The 232SDD16 is a general purpose control module that is connected to your computer’s RS-232serial port. The 232SDD16 offers 16 discrete digital I/O lines. With these features, the module can be used to sense external ON/OFF conditions and to control a variety of devices.

The digital outputs are CMOS/TTL compatible. The digital inputs are CMOS/TTL compatible. The digital I/O lines are available through a DB-25S(female) connector.

The 232SDD16 connects to your computer’s RS-232serial port through aDB-25Sconnector. The unit automatically detects baud rates from 1200 to 9600. A data format of 8 data bits, 1 stop bit and no parity is used.

Configuration parameters are stored in non-volatilememory. The configuration parameters consists of I/O definitions, and outputpower-upstates.

The unit may be powered by setting RTS and DTR high on the serial port. If the 232SDD16 cannot be powered using the handshake lines, it may be powered with +12Vdc through the 2.5mm jack or through the DB-25I/O connector.

NOTE: When using an external supply, the supply should be connected only to specifically labeled power inputs (power jack, terminal block, etc.). Connecting an external power supply to the handshake lines may damage the unit. Contact technical support for more information on connecting an external power supply to the handshake lines.

Figure 1.2 - Simplified Block Diagram

Packing List

Examine the shipping carton and contents for physical damage. The following items should be in the shipping carton:

1.232SDD16 unit

2.Software

3.This instruction manual

If any of these items are damaged or missing contact B&B Electronics immediately.

Figure 1.1 - 232SDD16 Module

232SDD16-1005Manual

1

2

232SDD16-1005Manual

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

I/O Lines
Total:
Digital Inputs
Voltage Range: Low Voltage: High Voltage: Leakage Current:
Digital Outputs
Low Voltage:
High Voltage:
Power Supply
Input Voltage: External power: Port power:

232SDD16 Specifications

16 (Factory default = inputs)

0 Vdc to 5 Vdc

1.0 Vdc max.

2.0 Vdc min.

1 microamp max.

0.6 Vdc @ 8.3 milliamps (Sink)

4.3 Vdc @ -3.1milliamps (Source)

8 Vdc to 16 Vdc

35 milliamps* @ 12Vdc

15 milliamps* (The RS-232RTS and DTR lines must be high to port power unit.)

Doesn’t include the power consumption of external devices.

Communications

 

Standard:

RS-232(unit is DCE)

Baud Rate:

1200 to 9600 (automatic detection)

Format:

8 data bits, 1 stop bit, no parity

Connector:

DB25S (female)

Size

0.7" x 2.1" x 4.7"

232SDD16-1005Manual

3

4

232SDD16-1005Manual

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

Chapter 2 - Connections

This chapter will cover the connections required for the 232SDD16. There are three sets of connections: digital I/O, serial port, and power supply. Do not make any connections to the 232SDD16 until you have read this chapter.

Digital I/O Connections

Connections to the I/O lines are made through the DB25S (female) I/O port connector. Refer to Table 2.1. See Chapter 5 for I/O interfacing examples.

Digital Inputs

The digital input lines are CMOS/TTL compatible and can handle voltages from 0Vdc to +5Vdc.

Digital Outputs

The digital output lines have a maximum voltage of +5Vdc and are CMOS/TTL compatible.

Ground

The pin should be connected to your external digital devices ground.

232SDD16-1005Manual

5

Table 2.1 - 232SDD16 I/O Port Pinout

DB-25S

 

 

DB-25S

 

Pin #

Function

 

Pin #

Function

 

 

 

 

 

1

No connection

 

14

I/O #15

2

No connection

 

15

I/O #14

3

No connection

 

16

I/O #13

4

No connection

 

17

I/O #12

5

No connection

 

18

I/O #11

6

No connection

 

19

I/O #10

7

Ground

 

20

No connection

8

+12Vdc Input

 

21

I/O #9

9

I/O #0

 

22

I/O #8

10

I/O #1

 

23

I/O #7

11

I/O #2

 

24

I/O #6

12

I/O #3

 

25

I/O #5

13

I/O #4

 

 

 

Serial Port Connections

In order to communicate to the 232SDD16 module it must be connected to an RS-232serial port. The unit automatically detects baud rates from 1200 to 9600. A data format of 8 data bits, 1 stop bit and no parity is used. The 232SDD16 is configured as a DCE device (See Table 2.2). If your communications equipment is configured as a DTE device, such as a standard IBM PC serial port, the 232SDD16 should be connected using a “straight through” DB25 cable or a standardDB-9toDB-25cable adapter as shown in Table 2.3. If your communications equipment is configured as a DCE device, such as a modem, the 232SDD16 should be connected using a “null modem” cable (See Table 2.4).

6

232SDD16-1005Manual

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

Table 2.2 - RS-232Connector Pinout

 

 

Signal

 

DB-25S

 

Direction at

 

Pin #

Signal

232SDD16

Notes

 

 

 

 

2

Transmit Data (TD)

Input

Connection is required.

3

Receive Data (RD)

Output

Connection is required.

4

Request to Send

Input

May be used to power

 

(RTS)

 

unit if kept high.

7

Signal Ground (SG)

 

Connection is required.

20

Data Terminal

Input

May be used to power

 

Ready (DTR)

 

unit if kept high.

Table 2.3 - 232SDD16 To DTE Connections

232SDD1

 

DTE DB-

DTE DB-9

6 Pin #

Signal

25

Connection

 

 

Connection

 

 

 

 

 

2

Transmit Data (TD)

2

3

3

Receive Data (RD)

3

2

4

Request to Send (RTS)

4

7

7

Signal Ground (SG)

7

5

20

Data Terminal Ready (DTR)

20

4

Table 2.4 - 232SDD16 To DCE Connections

232SDD16

 

DCE DB-25

DCE DB-9

Pin #

Signal

Connection

Connection

 

 

 

 

2

Transmit Data (TD)

3

2

3

Receive Data (RD)

2

3

4

Request to Send (RTS)

5

8

7

Signal Ground (SG)

7

5

20

Data Terminal Ready

6

6

 

(DTR)

 

 

232SDD16-1005Manual

7

Power Supply Connections

Power to the 232SDD16 can be supplied by the RS-232serial port handshake lines (RTS, DTR) or by an external power supply through the 2.5mm power jack or from the I/O connector. Most serial ports can provide enough power to supply the 232SDD16’s 15 milliamp requirement. If you plan to use this method to power the unit, your software must set theRS-232RTS and DTR lines to the high state. An external power supply must be able to supply 8 to 16 Vdc at 35ma.

NOTE: Power requirements of the module does not include the power consumption of any external devices connected to the module. Therefore, any current that is sourced by the digital outputs must be added to this value and the current must not exceed the maximum output source current. Refer to the 232SDD16 Specification Section of this manual.

8

232SDD16-1005Manual

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

Chapter 3 - Commands

There are only two commands required to control the 232SDD16: set output lines, and read I/O lines. Three additional commands are used for configuring the module: define I/O lines, set power-upstates, and read configuration. Command strings are from four to six bytes in length; the “!” character, the “0” (zero) character, two command characters, and one or two data bytes, if required. (See Table 3.1).

Table 3.1 - 232SDD16 Commands

Function

 

Command

Response

 

 

 

 

Set Output Lines

 

!0SO{I/O msb}{I/O lsb}

no response

Read I/O Lines

 

!0RD

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

Define I/O Lines

 

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

no response

Set Power-upStates

 

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

no response

 

 

 

I/O Definitions

Read Configuration

 

!0RC

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

 

 

 

Power-upStates

 

 

 

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

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: “!0RD”. 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 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 listed above. Refer to Appendix A for more ASCII and decimal equivalents.

232SDD16-1005Manual

9

Table 3.2 - Equivalent Values

ASCII

Decimal

Hexadecimal

 

 

 

!

33

21h

0

48

30h

C

67

43h

D

68

44h

O

79

4Fh

R

82

52h

S

83

53h

Syntax

Command strings consists 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 (useful in RS-485networks). Since the 232SDD16 usesRS-232communications, this byte is always the ASCII “0” character and can not be changed. 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. This field contains the fifth and sixth data byte, aMostSignificant and aLeastSignificant 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 outputs 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.

10

232SDD16-1005Manual

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

A byte represents an eight-bitbinary 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-1005Manual

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-1005Manual

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

Command: !0SO

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

Define I/O Lines Command

The Define I/O Lines command is used to define each of the 16 I/O lines as either an input or an output. This command requires two data bytes. Each data byte defines eight I/O lines. The first data byte defines the eight most significant I/O lines (15 - 8). The second data byte defines the eight least significant digital I/O lines (7 - 0). If a bit position is set to a "0" then the I/O line will defined as an input. If a bit position set to a "1" then the I/O line will be defined as an output.

Command: !0SD

Argument: {I/O msb}{I/O lsb} Response: none

ASCII Example: !0SDUA

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

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

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

Description: the first byte define I/O lines #14, 12, 10, & 8 as outputs and I/O lines #15, 13, 11, & 9 as inputs; the second byte define I/O lines #6, & 0 as outputs and I/O lines #7, 5, 4, 3, 2, & 1 as inputs.

232SDD16-1005Manual

13

Set Power-upStates Command

The Set Power-upStates command is used to set the states of output lines when the module's power is recycled. This command requires two data bytes. These data bytes specify the output state of each output line. The first data byte represents the eight most significant I/O lines (15 - 8). The second data byte represents the eight 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.

Command: !0SS

Argument: {I/O msb}{I/O lsb} Response: none

ASCII Example: !0SSÛ@

Dec. Example: !0SS<219><64>

Hex. Example: !0SS<DB><40>

Bin. Example: !0SS<11011011><10000000>

Description: the first byte sets output lines #15, 14, 12, 11, 9, & 8 HIGH and output lines #13, & 10 LOW at power-up;the second byte sets output line #7 HIGH and output lines #6, 5, 4, 3, 2, 1, & 0 LOW atpower-up.Note: If any of these lines are defined as inputs the bit settings are ignored.

Read Configuration Command

The Read Configuration command returns the module's I/O definitions and the outputs power-upstate. Four data bytes are returned. The first two data bytes contain the definition of the eight most significant I/O lines (15 - 8) and the eight least significant I/O lines (7 - 0) respectively. If a bit position is set to a "0" the I/O line is defined as an input, if set to a "1" the I/O line is defined as an output. The second two data bytes contain thepower-upstates of the most significant output lines (15 - 8) and the least significant output lines (7 - 0) respectively. If a bit position is set to a "0" thepower-upstate of the output will be LOW, if set to a "1" the output will be HIGH.

14

232SDD16-1005Manual

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

Command: !0RC Argument: none

Response: definition of the sixteen I/O lines in two 8 bit bytes, and the power-upstates in two 8 bit bytes. (shown in bold face)

ASCII Example: !0RCUAP@

Dec. Example: !0RC<85><65><80><64>

Hex. Example: !0RC<55><41><50><40>

Bin. Example: !0RC<01010101><01000001><01010000><01000000> Description: the first byte (MSB of I/O definitions) - I/O lines #14, 12, 10, & 8 are outputs and I/O lines #15, 13, 11, & 9 are inputs; the second byte (LSB of I/O definitions) - I/O lines #6, & 0 are outputs

and I/O lines #7, 5, 4, 3, 2, & 1 are inputs; the third byte (MSB of output power-upstates) - output lines #14, & 12 HIGH and output lines #10, & 8 LOW atpower-up;the fourth byte (LSB of outputpower-upstates) - output line #6 HIGH and output line #0 LOW atpower-up.

232SDD16-1005Manual

15

16

232SDD16-1005Manual

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