RS-485 Data Acquisition Module Model 485SDA10 Document No. 485SDA103798 This product Designed and Manufactured In Ottawa, Illinois USA of domestic and imported parts by B&B Electronics Mfg. Co. Inc. 707 Dayton Rd. -- P.O. Box 1040 -- Ottawa, IL 61350 PH (815) 433-5100 -- FAX (815) 434-7094 Internet: http://www.bb-elec.com sales@bb-elec.com support@bb.elec.com 1995 B&B Electronics -- Revised September 1998 485SDA103798 Manual Cover Page B&B Electronics -- 707 Dayton Rd.
Table of Contents Chapter 1- Introduction ...........................................1 485SDA10 Features ...................................................... 1 Packing List ................................................................... 2 Software Installation ...................................................... 2 DOS ...................................................................................... 2 Windows 3.11 .......................................................................
Set Turn-around Delay Command ............................... 17 Read Module Configuration Command........................ 17 Chapter 4 - A/D .......................................................19 Sampling Rate ............................................................. 19 A/D Input Range .......................................................... 19 Reference Inputs ......................................................... 19 Data Range .................................................................
TABLE 5.1 - DIGITAL I/O MASK VALUES.................................... 24 TABLE A-1 EXTENDED COMMANDS........................................ A-2 TABLE C-1: DECIMAL TO HEX TO ASCII TABLE.................... C-1 485SDA103798 Manual Table of Contents B&B Electronics -- 707 Dayton Rd.
Chapter 1- Introduction 485SDA10 Features The 485SDA10 is a general purpose control module which operates through an RS-485 interface. The 485SDA10 offers 11 channels of 10-bit A/D (analog to digital), 3 digital inputs and 3 digital outputs. With these features, the module can be used to sense a variety of external conditions and to control a variety of devices. The 11 A/D channels allow you to measure voltages from 0 to 5 Volts. The 3 digital inputs and 3 digital outputs are CMOS/TTL compatible.
Figure 1.2 - General Block Diagram Packing List Examine the shipping carton and contents for physical damage. The following items should be in the shipping carton: • 485SDA10 unit • One 485SDA10 3.5” disk • This instruction manual • RS-485/422 Application Note If any of these items are damaged or missing contact B&B Electronics immediately. Software Installation The 485SDA10 comes with several useful programs such as a data logging utility, a demonstration program, etc.
Windows 3.11 1. Insert SDA Logger installation disk in your floppy drive. 2. Click the File Manager button. 3. Select the floppy drive containing the SDA Logger installation disk. 4. Double click the Setup.exe icon when it appears. 5. Follow the installation instructions as prompted. Windows 9x and Windows NT 1. Insert the SDA Logger installation disk in your floppy drive. 2. Click Start | Run. 3. Click the Browse button and choose the floppy drive containing the SDA Logger installation disk. 4.
variable resistor must be greater than 1k Ohms to limit the output current to 5mA. • Connect A/D Ref Input+ to +5V DC. • Connect A/D Ref Input- to analog ground (See Figure 1.3). • Connect the 485SDA10 to an RS-422 or 4-wire RS-485 serial port. Once your connections have been made, run the demo program. Any change in A/D or digital lines on the 485SDA10 will automatically be displayed on the screen. Figure 1.3 - A/D with Variable Resistor 4 485SDA103798 Manual B&B Electronics -- 707 Dayton Rd.
485SDA10 Specifications Analog to Digital Converter Resolution: 10 bit Channels: 11 Reference Range: 5.0V DC max. (4.888 mV per bit) 2.5V DC min. (2.444 mV per bit) A/D Ref. Input 0V DC to 2.5V DC A/D Ref. Input + 2.5V DC to 5.0V DC Input Voltage Range: -0.3V DC to 5.3V DC Total Unadjusted Error: +/- 1 LSB max. A/D input channels must be driven from a source impedance less than 1kΩ. 5 Volt Reference Output Voltage: 4.975 to 5.025V DC (5.0V DC typ.) Accuracy: +/- 0.5 % Output Current: 5mA max.
Chapter 2 - Connections This chapter will cover the connections required for the 485SDA10. There are four sets of connections: • A/D converter • Digital I/O • Serial port • Power supply Do not make any connections to the 485SDA10 until you have read this chapter. CAUTION: When making electrical connections it is important to power down the devices being connected. If this is not possible, precautions must be taken to ensure electrical specifications are not exceeded.
A/D Ref Input The voltage connected to this pin determines the low end of the input voltage range. For proper operation, this pin must be connected to a DC voltage between 0 and +2.5 Volts. Typically, this is connected to your device’s ground and analog ground (0V). Analog Ground This pin should be connected to your analog device’s ground. If ground (0V) is the low end of your input voltage range, A/D Ref Input- should be connected to this pin.
Digital I/O Connections The digital I/O connections are made on the I/O port, which is a DB-25S (female) connector. Table 2.1 shows the pinout of the I/O port. The next sections explain the functions and connections for the various digital signals. Table 2.1 - 485SDA10 I/O Port Pinout DB-25S DB-25S Pin # Function Pin # Function 1 GND 14 Digital Output #0 2 +12V DC Output* 15 Digital Output #1 3 Digital Input #0 16 Digital Output #2 4 Digital Input #1 17 +5V DC Output 5 Digital Input #2 18 A/D Ref.
Digital Ground Connect the digital ground pin to your digital device's ground. To minimize noise, do not connect analog ground and digital ground together. Connect unused digital inputs to digital ground. Typical Connections Figure 2.2 shows the typical connections of the 485SDA10 for the digital I/O lines. Figure 2.2 - Typical Digital I/O Connections 485SDA103798 Manual B&B Electronics -- 707 Dayton Rd.
Serial Port Connections To communicate with the 485SDA10 module, it must be connected to an RS-422/RS-485 serial port. The 485SDA10 works with 2-wire or 4-wire RS-485. 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. Connections are made using terminal blocks. Table 2.2 shows the terminal blocks and their functions. Table 2.
Figure 2.3 - Typical RS-485 2-wire Connection Figure 2.4 - Typical RS-422 Connection Power Supply Connections The 485SDA10 requires 7 to 18 V DC at 30mA. Remember that the 30mA requirement doesn’t include the power consumption of any external devices. Therefore, any current sourced with the digital outputs must be added to this value. 485SDA103798 Manual B&B Electronics -- 707 Dayton Rd.
Chapter 3 - Commands There are only three commands required to control the 485SDA10: • Read A/D command • Read digital I/O command • Set output states command There are four commands used to configure the module: • Set power-up states command • Set turn-around delay command • Set module address command • Read module configuration command The command string consists of four bytes. Some commands require an additional data byte.
The decimal and hexadecimal equivalents of some ASCII characters are shown in Table 3.2. Notice that the ASCII representation of the character “0” does not have a value of 0. Refer to Appendix C for more ASCII, decimal, and hexadecimal equivalents. Table 3.2 - Equivalent Values ASCII Decimal Hexadecimal ! 0 A D O R S NUL SOH STX ETX EOT ENQ ACK BEL 33 48 65 68 79 82 83 0 1 2 3 4 5 6 7 21h 30h 41h 44h 4Fh 52h 53h 0h 1h 2h 3h 4h 5h 6h 7h Syntax The command string consists of four bytes.
The Read A/D channels command returns two bytes for each channel read. The two bytes represent the most significant byte (MSB) and least significant byte (LSB) of the reading. The MSB is received first, followed by the LSB. This command requires a data byte. The data byte is used to specify the number of the highest channel to be read. All channels less than this channel will be read as well. For example, if the data byte has a value of 6, then channels 0 to 6 will be read.
Reading Digital I/O Command The Read Digital I/O command returns a byte which represents the states of the 3 digital input and 3 digital output states. Bits 3-5 correspond to the states of digital inputs 0-2. Bits 0-2 correspond to the states of digital outputs 0-2. If a bit is a 0 then the digital state of that digital I/O is LOW. If a bit is a 1 then the digital state of the I/O is HIGH. Refer to Table 3.4 and 3.5.
Set Digital Output Command The Set Digital Output command is used to set the states of the 3 digital output lines. This command requires a data byte. The data byte is used to specify the output states. Bits 0-2 correspond to the states of digital outputs 0-2. If a bit is a 0 then the output will be set LOW. If a bit is a 1 then the output will be set HIGH. Refer to Table 3.6. NOTE: This command ignores Bits 3-7 of the data byte.
Set Power-up States Command The Set Power-up States command is used to set the states of the digital outputs at power-up. This command requires a data byte. The data byte is used to specify the power-up output states. Bits 0-2 correspond to the power-up states of digital outputs 0-2. If a bit is a 0 then the output will be set LOW at power-up. If a bit is a 1 then the output will be set HIGH at power-up. Refer to Table 3.6. NOTE: This command ignores bits 3-7 of the data byte.
{address}{states}{delay} Where {address} is a byte representing the module’s current address, {states} is a byte representing the module’s power-up states, and {delay} is a byte representing the module’s turn-around delay. 18 485SDA103798 Manual B&B Electronics -- 707 Dayton Rd.
Chapter 4 - A/D This chapter will deal with manipulating an A/D reading and cover some of the aspects that were not explained in the A/D Connections chapter. Sampling Rate The A/D converter has a conversion time of around 20 microseconds, however the sampling rate is limited by the serial communications. The maximum sampling rate for a single channel is around 120 samples per second (9600 baud). This rate drops to 25 samples per second when sampling all of the channels.
Data Range The data range of the A/D converter is determined by A/D Ref Input+ and A/D Ref Input-. A/D Ref Input- sets the bottom of the data range. Any input voltage that is less than or equal to the A/D Ref Input- will be read as a zero. A/D Ref Input+ sets the top of the data range. Any input voltage that is greater than or equal to the A/D Ref Input+ will be read as a 1023 (3FFh).
The step size is also referred to as the resolution. Once the step size is known, all that is needed to determine the voltage of an A/D input is the number of steps. The data returned from the 485SDA10 is the number of steps. The voltage at the A/D inputs can be calculated as follows: Voltage = (# of steps) * (Step size) Example 4.1 - Assume: A/D Ref. Input + = 5.0V DC and A/D Ref.Input - = 0V DC. Therefore: Reference Range = (A/D Ref. Input +) - (A/D Ref. Input -) Reference Range = (5.
Chapter 5 - Software This chapter covers programming techniques such as constructing a command string, receiving data and manipulating data. The various steps and examples are shown in QuickBasic. If you are programming in another language, these sections can be used as a guideline for programming the 485SDA10. Read A/D Command The Read A/D channels command returns two bytes for each channel read. The two bytes represent the most significant byte (MSB) and least significant byte (LSB) of the reading.
‘Get the value of channel 1 MSB$ = INPUT$ (1, #1) LSB$ = INPUT$ (1, #1) reading1 = (ASC(MSB$) * 256) + ASC(LSB$) ‘Get the value of channel 0 MSB$ = INPUT$ (1, #1) LSB$ = INPUT$ (1, #1) reading0 = (ASC(MSB$) * 256) + ASC(LSB$) The value of reading1 is the result of the A/D conversion on channel 1. The value of reading0 is the result of the A/D conversion on channel 0.
Table 5.1 - Digital I/O Mask Values Mask Values I/O Line Hexadecimal Decimal Digital Output #0 Digital Output #1 Digital Output #2 Digital Input #0 Digital Input #1 Digital Input #2 1H 2H 4H 8H 10H 20H 1 2 4 8 16 32 Example 5.2 - Determining the status of Digital Input #1 of the module with and address of 10. mask = &H10 Command$ = “!” + CHR$(addr) + “RD” Print #1, Command$; Reply$ = INPUT$ (1, #1) states = ASC (Reply$) status = states AND mask If status is equal to zero then Digital Input #1 is LOW.
b) Set Appropriate Outputs LOW states = states AND (NOT(mask)) By “ANDing” the current states with the complement of the appropriate mask of a digital output (given in Table 5.1), the output’s data bit will be set to a “0” (which will be set LOW). c) Construct the string Command$ = “!0SO” + CHR$(states) 2) Transmitting the command string: Print #1, Command$; Example 5.3 - Set Digital Output #0 HIGH and Digital Output #2 LOW of the module with and address of 5.
Example 5.4 – Change the address of a model from 5 to 10. addr = 5 newaddr = 10 Command$ = “!” + CHR$(addr) + “SA” + CHR$(newaddr) Print #1, Command$ Set Power-up States Command The Set Power-up States command is used to set the states of the digital outputs at power-up. This command requires a data byte. The data byte is used to specify the power-up output states. Bits 0-2 correspond to the power-up states of digital outputs 0-2. If a bit is a 0 then the output will be set LOW at power-up.
‘ Clear bit 2 of states to make digital output 2 LOW states = states AND (NOT(4)) Command$ = “!” + CHR$(addr) + “SS” + CHR$(states) Print #1, Command$ At power-up digital output 0 will be HIGH, digital output 1 will be HIGH, and digital output 2 will be LOW. Set Turn-around Delay The Set Turn-around Delay command sets the amount of time the 485SDA10 waits to respond after executing a command.
Read Module Configuration The Read Module Configuration command reads the 485SDA10’s address first, then the power-up states, and finally the turn-around delay. The steps to reading a module’s configuration are given below: 1) Constructing the command string: Command$ = “!” + CHR$(addr) + “RC” Where addr is the module’s address.
Appendix A: Adding Data Field Confirmation 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 485SDA10 receives an error in one or more of the first four command characters (“!0xx”), the unit will not execute the command.
Table A-1 Extended Commands Function Command Response Read A/D Channels #{addr}RA{x}{~x} Read Digital I/O Set Output States Set Module Address Set Power-up States Set Turn-around Delay Read Configuration #{addr}RD #{addr}SO{x}{~x} #{addr}SA{new addr}{~new addr} #{addr}SS{x}{~x} {chxmsb}{~chxmsb}{chxlsb} {~chxlsb}{ch(x-1)msb}...
Appendix B: Analog Input Impedance When interfacing with an A/D converter, it is important that the device you are connecting can drive the A/D input. To determine if your device can drive an A/D input, there are three factors you must consider: • Output impedance of the device • Input impedance of A/D • A/D sampling time The goal is to have the voltage at the A/D input settle to a voltage close to the output voltage of the device in a time frame that is less than the A/D sampling time.
Simplified Analog Input Analysis Using the equivalent circuit in Figure B-1, the time required to charge the analog input capacitance from 0 to Vs within ½ LSB can be derived as follows: The capacitance charging voltage is given by Vc = Vs (1 − e where − tc Rt Ci ) (1) Rt = Rs + ri The final voltage to ½ LSB is given by Vc (1 2 LSB ) = Vs − (Vs 2048) (2) Equating equation 1 to equation 2 and solving for time tc gives Vs − (Vs 2048 ) = Vs (1 − e − tc Rt Ci ) (3) and (4) t c (1 2 LSB ) = Rt × C
Figure B-1. Equivalent Input Circuit Including the Driving Source 485SDA103798 Manual Appendix B B-3 B&B Electronics -- 707 Dayton Rd.
Appendix C: Decimal to HEX to ASCII Table Table C-1: Decimal to HEX to ASCII Table 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 ct
FEDERAL COMMUNICATIONS COMMISSION RADIO FREQUENCY INTERFACE STATEMENT Class A Equipment This equipment has been tested and found to comply with the limits for Class A digital device, pursuant to Part 15 of the FCC Rules. These limits are designed to provide reasonable protection against harmful interference when the equipment is operated in a commercial environment.