RS-232 Digital 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.
Table of Contents 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-up States Command .................................
Chapter 1- Introduction 232SDD16 Features The 232SDD16 is a general purpose control module that is connected to your computer’s RS-232 serial 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.
232SDD16 Specifications I/O Lines Total: 16 (Factory default = inputs) Digital Inputs Voltage Range: Low Voltage: High Voltage: Leakage Current: 0 Vdc to 5 Vdc 1.0 Vdc max. 2.0 Vdc min. 1 microamp max. Digital Outputs Low Voltage: High Voltage: 0.6 Vdc @ 8.3 milliamps (Sink) 4.3 Vdc @ -3.1 milliamps (Source) Power Supply Input Voltage: External power: Port power: 8 Vdc to 16 Vdc 35 milliamps* @ 12Vdc 15 milliamps* (The RS-232 RTS and DTR lines must be high to port power unit.
Table 2.1 - 232SDD16 I/O Port Pinout Chapter 2 - Connections DB-25S Pin # 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. 1 2 3 4 5 6 7 8 9 10 11 12 13 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.
Power Supply Connections Table 2.2 - RS-232 Connector Pinout DB-25S Pin # 2 3 4 7 20 Signal Direction at 232SDD16 Signal Transmit Data (TD) Receive Data (RD) Request to Send (RTS) Signal Ground (SG) Data Terminal Ready (DTR) Input Output Input Input Notes Connection is required. Connection is required. May be used to power unit if kept high. Connection is required. May be used to power unit if kept high. Table 2.
Table 3.2 - Equivalent Values 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-up states, 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.
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. 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.
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.
Command: !0RC Argument: none Response: definition of the sixteen I/O lines in two 8 bit bytes, and the power-up states 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.
Chapter 4 - I/O Interfacing This chapter will explain "HIGH" and "LOW" states and show some general examples of how to interface to the I/O lines. Caution must be taken not to exceed 232SDD16 specifications listed in Chapter 1 when interfacing to external devices. Failure to stay within these specifications could result in damage to the unit and will void warranty. Digital Inputs As stated earlier, digital input lines are CMOS/TTL compatible and can only handle voltages from 0Vdc to +5Vdc.
Figure 4.4 - Isolated Solid State Input Figure 4.6 - Isolated Solid State Output Digital Outputs Digital outputs are used to turn external devices on or off. Digital outputs are CMOS/TTL compatible and operate between 0Vdc and +5Vdc. Outputs can be used to control solid state output modules, CMOS and TTL logic circuits. Caution must be taken not to exceed the power capability of the outputs. Refer to the output specifications in Chapter 1.
Chapter 5 - Software This chapter will be divided into two sections. The first section covers programming techniques for constructing a command string, receiving data and manipulating data in QuickBASIC. The second section discusses how to install and run the demonstration program on an IBM PC or compatible. Programming Techniques This section shows steps and examples of programming the 232SDD16 in QuickBasic.
Step 5 - Determining the I/O line definitions: MSdefs = MSdefs AND mask LSdefs = LSdefs AND mask By "ANDing" the value of MSdefs or LSdefs with the appropriate mask of an I/O line, the I/O line definition can be determined. If the status is equal to zero the I/O line is an INPUT. If the status is not equal to zero the I/O line is an OUTPUT. Table 5.1 shows the mask values for each I/O line. Step 6 - Repeat Step 5 until the status of each I/O line has been determined.
Define I/O Lines Command Step 1a - Construct the command string: Define an I/O line as Output MSdefs = MSdefs OR mask LSdefs = LSdefs OR mask By "ORing" the current definitions with the appropriate I/O line mask, the I/O line's data bit will be set to a "1" (HIGH) and the I/O line will be defined as an Output.
Demonstration Program The 232SDD16 Demonstration (SDD16) Program (IBM PC or Compatible) provides the user with examples of how to receive and transmit commands to the 232SDD16. The SDD16.EXE is the executable program, the SDD16.BAS file is the source code in QuickBASIC. The source code provides an illustration of how to send and receive commands from the 232SDD16. NOTE: This is a demonstration program only and not intended for system applications.
DECIMAL to HEX to ASCII CONVERSION TABLE DEC HEX ASCII KEY DEC HEX ASCII DEC HEX ASCII DEC HEX ASCII 0 0 NUL ctrl @ 32 20 SP 64 40 @ 96 60 ` 1 1 SOH ctrl A 33 21 ! 65 41 A 97 61 a 2 2 STX ctrl B 34 22 “ 66 42 B 98 62 b 3 3 ETX ctrl C 35 23 # 67 43 C 99 63 c 4 4 EOT ctrl D 36 24 $ 68 44 D 100 64 d 5 5 ENQ ctrl E 37 25 % 69 45 E 101 65 e 6 6 ACK ctrl F 38 26 & 70 46 F 102 66 f 7 7 BEL ctrl G 39 27 ' 71 47 G 10
The decimal (base 10) numbering system represents each position in successive powers of 10, with each decimal symbol having a value from 0 to 9. The hexadecimal (base 16) numbering system represents each position in successive powers of 16 with each hex symbol having a value of 0 to 15. Since each hex position must have a single symbol, the symbols "A" through "F" are assigned to values 10 through 15 respectively. Refer to Table 1.
Hexadecimal to Decimal Conversion: Decimal = (1st Hex digit x 4096) + (2nd Hex digit x 256) + (3rd Hex digit x 16) + (4th Hex digit) Each "Hex digit" is the decimal equivalent value of the hexadecimal symbol. Example: Convert 10FC hexadecimal to decimal. 1 x 4096 = 4096 0 x 256 = 0 15 x 16 = 240 12 x 1 = 12 4348 10FC hex equals 4348 decimal. Decimal to Hexadecimal Conversion: Example: Convert 4348 decimal to hexadecimal.
DTB25 The DTB25 connects to the SDD16 models to provide easy access to the available I/O lines. The DTB25 plugs directly into the SDD16's DB25S I/O Port connector. Each of the twenty-five pins on the connector is brought out to a terminal block. Refer to Table C.1. Dimensions: 0.5" x 2.1" x 4.3". An enclosure for the DTB25 is available. APPENDIX C Interface Modules for SDD16 Models Figure C.
DBM16 Table C.1 - DTB25 Connections DB-25P Pin # Function T.B. # DB-25P Pin # 1 2 3 4 5 6 7 8 9 10 11 12 13 Unused. Unused. Unused. Unused. Unused. Unused. Ground +12Vdc Input I/O #0 I/O #1 I/O #2 I/O #3 I/O #4 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 232SDD16-1005 Manual Function I/O #15 I/O #14 I/O #13 I/O #12 I/O #11 I/O #10 Unused.
DBM16 Interfacing This section will show some general examples of how to interface the DBM16 I/O lines to external devices. Caution must be taken not to exceed the DBM16 specifications, failure to do so could result in damage to the DBM16 and will void the warranty. Before connecting the DBM16 to the SDD16 module and connecting any external device to the DBM16 determine which I/O lines on the SDD16 module are inputs and which are outputs.
Figure C.6 - Isolated Solid State Input Figure C.8 - Isolated Mechanical Output Outputs Digital outputs are used to turn "ON" or turn "OFF" external devices. Outputs can be used to control solid state output modules, logic circuits, and relays. Caution must be taken not to exceed the power capability of the outputs. Refer to the DBM16 output specifications. Setting the SDD16 module's output line to a "1" turns "ON" the DBM16's output line.
DBM16 Specifications I/O Lines Total: Inputs Voltage range: Low Voltage: High Voltage: Internal pull-up current: Outputs Output Voltage: Output current: Output leakage current: Output saturation voltage: 16 (Factory default - set to inputs) 0Vdc to +50Vdc 0Vdc to +1.5Vdc +2.5Vdc to +50Vdc 0.5 ma +50Vdc max. 350 ma max. - only 1 output on 100 ma max. - all outputs on 50 micro amp max. 1.1Vdc max.
232SDD16-1005 Manual Appendix C B&B Electronics -- PO Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 433-5104 C-11
With serial communications in a laboratory environment, the possibility of a communication error occurring is minimal. However, in a harsh or an industrial environment the possibility increases. A communication error occurs when a bit transmitted as a “1” is received as a “0” or vice versa. If the 232SDD16 receives a error in one or more of the first four command characters (“!0xx”), the unit will not execute the command.
Table D-1 Extended Commands Function Command Response Read I/O Lines #0RD Set Output Lines #0SO{I/O msb}{~I/O msb}{I/O lsb}{~I/O lsb} #0SD{I/O msb}{~I/O msb}{I/O msb}{~I/O msb} #0SS{I/O msb}{~I/O msb}{I/O lsb}{~I/O lsb} #0RC {I/O msb}{~I/O msb}{I/O lsb}{~I/O lsb} no response Define I/O Lines Set Power-up States Read Configuration no response no response {I/O msb}{~I/O msb}{I/O lsb}{~I/O lsb}{I/O powerup msb states}{~I/O powerup msb states}{I/O powerup lsb states}{~I/O powerup lsb} Where “x” is