Applications



The applications listed illustrate basic interface requirements of various devices and ADR products. Sample programs are written in BASIC.


Potentiometers, Switches, LEDs, Solid-State Relays, LM335 Temperature Sensor, Stepper Motors, Daisy-Chaining



READING POTENTIOMETERS USING THE ADR101

To monitor potentiometer position, the analog inputs of the ADR101 are used. Before connecting a potentiometer to an analog input, the pot must be biased with 5 volts. This is done by simply connecting 5 volts to one side of the pot and ground to the other. The wiper (center connection) of the pot is then connected to one of the analog inputs. To read the pot position an RAx command is sent to the ADR101. The ADR101 will respond with position information as a percent full scale with a resolution of .5%.

This sample BASIC program below reads the position of the two pots and continually updates their position on the screen.

 7pot.gif (4746 bytes)


10 OPEN "COM1:9600,N,8,1,CS,DS,RS" AS#1

20 CLS

30 LOCATE 1,1

40 PRINT#1, "RA0"

50 INPUT#1, POT1

60 PRINT#1, "RA1"

70 INPUT#1, POT2

80 PRINT "POT#1 IS AT"POT1, "PERCENT"

90 PRINT "POT#2 IS AT"POT2, "PERCENT"

100 GOTO 40        




CONNECTING SWITCHES  TO DIGITAL PORTS

To connect switches to digital I/O lines only one additional component is required. Each digital input line used to read a switch must be tied to +5 volts with a 10Kohm resistor to avoid leaving the digital port floating when the switch is in the OPEN position. The switch is then connected between ground and the digital port. The program used to read the switches must first configure the digital I/O lines as input. This is done using the CPAxxxxxxxx command. To read the switch a RPAx command is used. The following BASIC program continually monitors the position of two switches and updates their status on the screen.

 switch1.gif (4885 bytes)

10 OPEN "COM1:9600,N,8,1,CS,DS,RS" AS#1

20 CLS

30 PRINT#1, "CPA11111111"

40 REM (FORCES CR)

50 PRINT#1, "RPA0"

60 INPUT#1, SWA

70 T1$="CLOSED" IF SWA=1 THEN T1$="OPEN"

80 PRINT#1, "RPA1"

90 INPUT#1, SWB

100 T2$="CLOSED" IF SWB=1 THEN T2$="OPEN"

110 LOCATE 1,1      

120 PRINT "SWITCH A IS "T1$

130 PRINT "SWITCH B IS "T2$

140 GOTO 50              




CONNECTING LED'S TO DIGITAL PORTS

To turn on LED's with the ADR101, digital I/O lines of PORT A are used. Any digital I/O lines used to drive LED'S must be configured as output. The I/O lines can sink and source 20mA of current so only a 220ohm current limit resistor is required to light the LED'S. LED'S may be driven by a logic 1 (LED 1) requiring the current limit resistor to be connected to ground, or by a logic 0 (LED 2) requiring the current limit resistor to be connected to 5 vdc. The following BASIC program demonstrates how to turn the LED'S on and off.

LED.gif (16946 bytes)


10 OPEN "COM1:9600,N,8,1,CS,DS,RS" AS#1

20 PRINT#1, "CPA11111100"

30 REM TURN ON LED#1

40 PRINT#1, "SETPA0"

50 REM TURN OFF LED#1

60 PRINT#1, "RESPA0"

70 REM TURN OFF LED#2

80 PRINT#1, "SETPA1"

90 REM TURN ON LED#2

100 PRINT#1, "RESPA1"

110 BEEP

120 GOTO 30          




DRIVING SOLID-STATE RELAYS

Solid-state relays that require a DC input voltage to operate may be controlled by the ADR101 to allow the control of AC loads such as motors lights etc.. The relay must be able to operate with a DC input of 4 volts ( 3-32 Volts is typical) and an input current of under 20mA. The relay must be rated with the proper voltage and current ratings for whatever load is to be controlled. Each relay will require one digital I/O line to operate. In the example below a relay is connected to PA0 and the sample program demonstrates how the relay is turned on. Note that the I/O line is set high before the CPAxxxxxxxx command configures the line as output. This is to ensure the relay is not energized inadvertently when the port is configured and PA0 is low.

 7Ssr.gif (5469 bytes)


10 OPEN "COM1:9600,N,8,1,CS,DS,RS" AS#1

20 REM  SET PA0 SO RELAY DOES NOT ENERGIZE

30 PRINT#1, "SETPA0"

40 REM CONFIGURE I/O LINE AS OUTPUT

50 PRINT#1, "CPA11111110"

60 REM TURN ON RELAY

70 PRINT#1, "RESPA0"

80 REM TURN OFF RELAY

90 PRINT#1, "SETPA0"

100 END

        




SOLID-STATE TEMPERATURE MEASUREMENT

ADR112 and ADR2000 users, see note below.

The LM335 will measure temperature from -40 to +100 degrees celcius and outputs 10mV per degree kelvin. The sample circuit was designed to measure 0-50 degrees celcius and output 100mV per degree. This was accomplished using an LTC2272 op-amp in the difference amplifier configuration. The LM335 is connected to the non-inverting input of the 2272 and 2.73 volts is applied to the inverting terminal. This, in effect, subtracts 2.73 volts from the output of the LM335 converting the kelvin output to celcius. The amplifier also has a gain of 10 to increase the sensitivity to 100mV per degree celcius NOTE: The measurement range and resolution of the sample circuit may be adjusted to any range or resolution within the -40 to +100 celcius operating range of the LM335. This can be done by adjusting the circuit gain and zero voltage ( 2.73 volts ).

7Temperature.gif (6833 bytes)

10 OPEN "COM1:9600,N,8,1,CS,DS,RS" AS#1

20 CLS

30 LOCATE 1,1

40 PRINT#1, "RA0"

50 INPUT#1, AN0

60 AN0=AN0/2

70 PRINT " TEMPERATURE IS " AN0, "DEGREES CELCIUS"

80 GOTO 30          

NOTE: When using the LM 335 with the ADR112 or ADR2000, the amplifier circuit is not required as the 12-bit resolution of the analog inputs will allow a better than .25 degree resolution with a direct measurement. Simply connect the LM335 to 5V and ground using a 1Kohm resistor ( R4 in diagram) and connect the output of the sensor to an analog input. Using an RDx command, the temperature will be returned as a number from 0 to 4095. To convert to Celcius use the following equation; C = (reading - 2235.9 ) / 8.19



Stepper Motors

Stepper motor translator and drive circuits typically require STEP and DIRECTION input signals to operate. These signal can be provided by PLC's, stepper indexers or stand-alone digital circuitry. The ADR products can be used to provide these signals using digital I/O and commands to SET and RESET the I/O lines.  The host can then control and   keep track of stepper position.

Stepbas.gif (1897 bytes)

Figure 1.  Basic Stepper Motor Application

The demand on the bandwidth of the  communication link between the host and standard ADR products limits step speeds to about 150 steps/second at 9600 baud. To overcome this limitation the ADR2100 has a complete dual stepper motor indexer built in to provide precise step and direction signals to stepper drive circuits with minimal use of the communication link between the host and ADR products. the indexer has the following features;

The stepper motor indexer uses port A of the ADR2100 when configured for STEPPER MODE. A Typical connection of a stepper motor linear slide application is shown in figure 2.

Stepadr.GIF (3072 bytes)

Figure 2 Typical Stepper Motor Application with ADR2100 as indexer.

The limit switch inputs have built in pull-ups allowing use of mechanical or inductive proximity switches. ( NPN) When limit switches are activated, movement in corresponding direction is disabled and an interrupt is generated ( if enabled ) The commands ( preliminary list ) to use the indexer are;

CPASTEP <cr>

Configures PORT A as stepper indexer.

MSddd <cr> ( ddd = 000 to 100 )( ddd*10 = actual speed setting)

Sets speed of move from 0 to 1000 steps/sec  in 10 step/sec increments. Speed is changable on the fly and has a worst case accuracy of 1%

LAFddddd<cr> ( ddddd= 00000 to 50000 )

Loads stepper motor A move register with steps to move Forward ( CW )

LARddddd<cr> ( ddddd= 00000 to 50000 )

Loads stepper motor A move register with steps to move Reverse ( CCW )

LBFddddd<cr> ( ddddd= 00000 to 50000 )

Loads stepper motor B move register with steps to move Forward ( CW )

LBRddddd<cr> ( ddddd= 00000 to 50000 )

Loads stepper motor B move register with steps to move Reverse ( CCW )

QA<cr>

Returns present number of steps to finish move of stepper motor A

QB<cr>

Returns present number of steps to finish move of stepper motor B

G<cr>

Begins move of both stepper motors.

E<cr>

Emergency Stop, stops all motor movement.

EI<cr>

Enables interrupt generation.

Additional features of the ADR2100 may enhance the application such as using the two event counters for encoder feedback or using the PWM outputs for motor torque control.





Section A:  Daisy Chaining ADR2000 Series  ( ADR2000A, ADR2000B, ADR2100 )

( See section B  below for daisy-chaining ADR1000 series.)

All ADR2000 series products have identical serial communication and daisy chain capabilities.  J1 has both an RS232 and RS485 port available while J3 is RS485 only.   The first board in the chain connects to the Host computer via RS232 or RS485 ( J1 ).  Subsequent boards may then be daisy chained using the RS485 port on J3. This allows daisy-chaining of up to 10 ADR2000 series boards in any combination with a single twisted pair cable. Power may also be jumpered if a two pair cable is used. This allows all boards on the chain to be powered by a single power supply.

ADR2000D2.gif (7402 bytes)

Typical Daisy-Chain Connection for ADR2000 Series Interfaces

Each board in the chain is given an address from 0 -9 via address jumpers on the ADR2000 series interfaces. When the address is set, that board responds only to commands preceded by that number. For example, to read analog port 4 on board 3 the following command is used;

3RD4<cr>

A very unique feature of this daisy-chain system is the fact that all ADR2000 series boards have a complete RS232 to RS485 transceiver on-board. This allows the use of RS232 devices at any node in the chain using the spare RS232 port. The host can then communicate transparently to that device provided its command syntax is not the same as the ADR2000 series products.

 

Section B:  Daisy Chaining ADR1000 Series

Daisy-chaining ADR1000 boards is possible using RS485, RS422 or RS232.  When using a standard RS232 port, the first board on the chain echos commands via an RS485 link to other boards. the following is a page from the ADR1000 user manual showing the daisy-chaining options.