B&B Electronics RS-232 Digital I/O Module 232SDD16 User Manual Download Page 15

232SDD16-1005 Manual 

25 

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

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

 

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. 

Step 1b - Define an I/O line as an Input 

MSdefs = MSdefs AND (NOT(mask)) 
LSdefs = LSdefs AND (NOT(mask))
 

By "ANDing" the current definitions with the complement of the 
appropriate I/O line mask the I/O line's data bit will be set to a "0" 
(LOW) and the I/O line will be defined as an Input. 

Step 1c - Completing the command string: 

Cmnd$ = "!0SD" + CHR$(MSdefs) + CHR$(LSdefs) 

Step 2 - Transmitting the command string: 

Print #1, Cmnd$; 

 
Example 5.4 - Define I/O line #7 as an Output (HIGH) and I/O line #8 

as an input (LOW). 

'Set bit 7 of LSdefs to make I/O line #7 an Output (HIGH). 

LSdefs = LSdefs OR &H80 

'Clear bit 0 of MSdefs to make I/O line #8 an Input (LOW). 

MSdefs = MSdefs AND (NOT(&H1)) 
Cmnd$ = "!0SD" + CHR$(MSdefs) + CHR$(LSdefs)
 
Print #1, Cmnd$; 
MSIO$ = INPUT$(1,#1) 

I/O #7 will be defined as an Output (HIGH) and I/O line #8 will be 
defined as an Input (LOW).  All other I/O definitions will not be 
changed. 
 
Set Power-up States Command 
Step 1a - Construct the command string: 

Set appropriate outputs power-up states HIGH 
MSpups = MSpups OR mask 
LSpups = LSpups OR mask
 

By "ORing" the current power-up states with the appropriate 
mask of a digital output line, the power-up state's data bit will be 
set to a "1" (HIGH). 

26 232SDD16-1005 

Manual 

 

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

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

 

Step 1b - Set appropriate outputs power-up states LOW 

MSpups = MSpups AND (NOT(mask)) 
LSpups = LSpups AND (NOT(mask))
 

By "ANDing" the current power-up states with the complement of 
the appropriate mask of a digital output line, the power-up state's 
data bit will be set to a "0" (LOW). 

Step 1c - Completing the command string: 

Cmnd$ = "!0SS" + CHR$(MSpups) + CHR$(LSpups) 

Step 2 - Transmitting the command string: 

Print #1, Cmnd$; 

 
Example 5.5 - Set Output line #5's power-up state HIGH and Output 

line #13's power-up state LOW. 

'Set bit 0 of LSpups to make Output #5's power-up state HIGH. 

LSpups = LSpups OR &H20 

'Clear bit 4 of MSpups to make Output #13's power-up state LOW. 

MSpups = MSpups AND (NOT(&H20)) 
Cmnd$ = "!0SS" + CHR$(MSpups) + CHR$(LSpups)
 
Print #1, Cmnd$; 
MSIO$ = INPUT$(1,#1) 

Output #5's power-up state will be set HIGH and output #13's 
power-up state will be set LOW.  All other output power-up states 
will not be changed. 
 

Summary of Contents for RS-232 Digital I/O Module 232SDD16

Page 1: ...umentation 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 ...

Page 2: ...and 14 Chapter 4 I O Interfacing 17 Digital Inputs 17 Digital Outputs 19 ii Table of Contents 232SDD16 1005 Manual 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 up States Command 25 Demonstration P...

Page 3: ...figuration parameters consists of I O definitions and output power up states 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 25 I O connector NOTE When using an external supply the supply should be connected only to specifically labeled power inpu...

Page 4: ...ps Sink High Voltage 4 3 Vdc 3 1 milliamps Source Power Supply Input Voltage 8 Vdc to 16 Vdc External power 35 milliamps 12Vdc Port power 15 milliamps The RS 232 RTS 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 Conn...

Page 5: ...33 5100 FAX 815 433 5104 Serial Port Connections In order to communicate to the 232SDD16 module it must be connected to an RS 232 serial 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 standa...

Page 6: ...Receive Data RD 2 3 4 Request to Send RTS 5 8 7 Signal Ground SG 7 5 20 Data Terminal Ready DTR 6 6 8 232SDD16 1005 Manual B B Electronics PO Box 1040 Ottawa IL 61350 PH 815 433 5100 FAX 815 433 5104 Power Supply Connections Power to the 232SDD16 can be supplied by the RS 232 serial port handshake lines RTS DTR or by an external power supply through the 2 5mm power jack or from the I O connector M...

Page 7: ...no response Set Power up States 0SS I O msb I O lsb no response Read Configuration 0RC I O Definitions I O msb I O lsb Power up States I O msb I O msb Symbols represents one byte represents a numeric value 10 232SDD16 1005 Manual B B Electronics PO Box 1040 Ottawa IL 61350 PH 815 433 5100 FAX 815 433 5104 Syntax Command strings consists of four to six bytes The first byte is the start of message b...

Page 8: ... Shown in hexadecimal C8 80h 40h 8h 52 40h 10h 2h I O lines 15 14 11 6 4 1 are HIGH All other I O lines are LOW 12 232SDD16 1005 Manual B B Electronics PO Box 1040 Ottawa IL 61350 PH 815 433 5100 FAX 815 433 5104 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 secon...

Page 9: ... States Command The Set Power up States 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 ...

Page 10: ... 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 up states output lines 14 12 HIGH and output lines 10 8 LOW at power up the fourth byte LSB of output power up state...

Page 11: ... are used to sense a HIGH or a LOW state This can be accomplished via switch closures contact closures or a solid state digital signal When an I O line defined as an input senses a voltage level above 2 0Vdc it will be considered HIGH and its input state will be read as a 1 Conversely when an input senses a voltage level below 1 0Vdc it will be considered LOW and its input state will be read as a ...

Page 12: ...l 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 Setting an output line to a 1 forces the output HIGH and setting an output line to a 0 forces the output LOW Figures 4 5 4 6 show examples of some typical output interfaces Figure 4 5 Solid State Output 20 232SDD16 1005 Man...

Page 13: ... O line can be determined If the status is equal to zero the I O line is LOW If the status is not equal to zero the I O line is HIGH 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 22 232SDD16 1005 Manual B B Electronics PO Box 1040 Ottawa IL 61350 PH 815 433 5100 FAX 815 433 5104 Example 5 1 Determining the status of I O...

Page 14: ... LSpups AND mask 24 232SDD16 1005 Manual B B Electronics PO Box 1040 Ottawa IL 61350 PH 815 433 5100 FAX 815 433 5104 If LSdefs equals zero then I O line 2 is an INPUT and if not equal to zero then I O line 2 is an OUTPUT If MSdefs equals zero then I O line 10 is an INPUT and if not equal to zero then I O line 10 is an OUTPUT If LSpups equals zero then Output line 2 s power up state is LOW and if ...

Page 15: ...O line 8 will be defined as an Input LOW All other I O definitions will not be changed Set Power up States Command Step 1a Construct the command string Set appropriate outputs power up states HIGH MSpups MSpups OR mask LSpups LSpups OR mask By ORing the current power up states with the appropriate mask of a digital output line the power up state s data bit will be set to a 1 HIGH 26 232SDD16 1005 ...

Page 16: ...es 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 Running Demonstration Program Before you can run the demonstration program you must run the install program in the Hard Drive Installation section If you are running Windows exit Windows to DOS To run the program follow these steps from the DOS...

Page 17: ... 9 HT ctrl I 41 29 73 49 I 105 69 i 10 A LF ctrl J 42 2A 74 4A J 106 6A j 11 B VT ctrl K 43 2B 75 4B K 107 6B k 12 C FF ctrl L 44 2C 76 4C L 108 6C l 13 D CR ctrl M 45 2D 77 4D M 109 6D m 14 E SO ctrl N 46 2E 78 4E N 110 6E n 15 F SI ctrl O 47 2F 79 4F O 111 6F o 16 10 DLE ctrl P 48 30 0 80 50 P 112 70 p 17 11 DC1 ctrl Q 49 31 1 81 51 Q 113 71 q 18 12 DC2 ctrl R 50 32 2 82 52 R 114 72 r 19 13 DC3 ...

Page 18: ...ach 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 The information and examples to follow will explain how to convert from a...

Page 19: ...adecimal symbol Example Convert 10FC hexadecimal to decimal 10FC hex equals 4348 decimal Decimal to Hexadecimal Conversion Example Convert 4348 decimal to hexadecimal 4348 decimal equals 10FC hexadecimal 1 x 4096 4096 0 x 256 0 15 x 16 240 12 x 1 12 4348 4096 4348 1 1 1st Hex digit 4096 256 252 0 0 2nd Hex digit 0 16 252 15 F 3rd Hex digit 240 1 12 12 C 4th Hex digit 12 0 B 4 Appendix B 232SDD16 1...

Page 20: ...ctor 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 Figure C 1 DTB25 Outline Drawing Before connecting any external devices to the DTB25 make sure the SDD16 module has been properly configured I O lines defined power up states set This will avoid possible damage to the module and...

Page 21: ...ower handling for all the sixteen I O lines of the SDD16 models Each of the I O lines can be programmed as an input or as an output by setting a jumper on the board The DBM16 plugs directly into the SDD16 s DB25S I O Port connector Terminal blocks are provided for all I O line power and ground connections Refer to Table C 2 An enclosure for the DBM16 is available Table C 2 DBM16 I O Connections T ...

Page 22: ...puts and outputs are known set the jumpers on the DBM16 accordingly Refer to Figure C 2 Figure C 2 DBM16 Outline Drawing Inputs Digital inputs are used to sense HIGH and LOW states based on voltage levels This is accomplished via switch closures contact closures or a solid state digital signals Each DBM16 input is pulled up through a resistor and will be read as a logic 1 HIGH by the SDD16 module ...

Page 23: ...ty 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 Setting the SDD16 module s output line to a 0 turns OFF the DBM16 s output driver The DBM16 outputs are open collector current sinking drivers Figures C 7 C 9 show examples of some typical output interfaces Figure C 7 Solid State Output C 8 Appendix C 232SDD16 1...

Page 24: ...current 350 ma max only 1 output on 100 ma max all outputs on Output leakage current 50 micro amp max Output saturation voltage 1 1Vdc max 100ma CAUTION Total output power cannot exceed 2 watts for I O s 0 7 and 2 watts for I O 8 15 25 degrees C Power Supply Input Voltage 8Vdc to 16Vdc 10milliamps Doesn t include the power consumption of external devices Connections Terminal Blocks Size 0 5 x 2 1 ...

Page 25: ...232SDD16 1005 Manual Appendix C C 11 B B Electronics PO Box 1040 Ottawa IL 61350 PH 815 433 5100 FAX 815 433 5104 ...

Page 26: ...SDD16 receives an communication error on a data byte I O byte for Read Digital command or state byte for Set Output State command the command will be executed since the unit has no way of knowing that there was an error To provide the 232SDD16 with a way of detecting errors in the data fields an additional set of commands can be used This set of commands begins with the 23h character instead of th...

Page 27: ...sponse Define I O Lines 0SD I O msb I O msb I O msb I O msb no response Set Power up States 0SS I O msb I O msb I O lsb I O lsb no response Read Configuration 0RC 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 the required data byte and signifies the complement of the specified byte D 4 Appendix D 232SDD16 1005 Manual...

Reviews: