Tutorials on programming the ADR boards for popular programming languages can be accessed by clicking the buttons on the upper bar. All tutorials provide the basics of accessing serial based devices using the corresponding software. Start by first viewing the commands, a listing of ASCII strings, and then select the programming language of your choice to view examples. Your language of choice may not be listed but almost all languages allow control via serial ports. Check your programmers reference guide under "RS232", "Com Ports" or "serial ports".
Important: Hyperterminal, which is included with Windows 95, allows users to send and recieve ASCII commands via a serial port. This is a powerfull debugging tool that can be used to determine if the ADR interface is connected and working properly. Use Hyperterminal to;
1. Verify proper connection of an ADR device to your serial port.
2. Verify interface hardware connected to the ADR device.
3. Familiarize programmers with ASCII commands used with ADR devices.
If you are a first time user or are having problems with a higher level language, use Hyperterminal to verify hardware connection and then return to desired programming language.
Commands
The following is a listing of commands for the ADR101. Additional commands specific to products with advanced features are listed in the appropriate user manual.
RAn Returns status of analog port specified by n in percent full scale.(n= 0or1) RDn Returns status of analog port specified by n in decimal format. (n= 0 or1)
CPAxxxxxxxx Configures PORT A. (x=1 for input, x=0 for output)
SPAxxxxxxxx Output binary data to PORT A. ( x=1 or 0 )
RPA Returns stautus of all I/O lines in PORT A in binary format.
RPAn Returns status of I/O line specified by n. (n= 0 to 7 )
MAddd Outputs decimal data (ddd) to PORT A. (ddd= 0 to 255 )
PA Returns status of PORT A in decimal format.
RESPAn Resets I/O line specified by n in PORT A. ( n= 0 to 7 )
SETPAn Sets I/O line specified by n in PORT A. ( n= 0 to 7 )
There are two analog input ports on the ADR101 labelled AN0 and AN1. ( See Connection Diagram ) The commands used to read the analog ports allow the user to read data in percent full scale or decimal format. The analog input voltage range is 0 to 5 volts. In percent full scale format, 0%=0 volts and 100%=5 volts. In decimal format, 000 = 0 volts and 255 = 5 volts. The two analog commands are;
RAn Returns status of analog port specified
by n in percent full scale. ( n = 0 or 1)
example;
RA0
76.5
(AN0 is at 76.5% of 5 volts or .765 X 5 = 3.825 volts)
RDn Returns status of analog port specified
by n in decimal format. ( n = 0 or 1)
example;
RD1
106
(AN1 is at decimal 106 or (106/255) X 5 =2.08 volts )
There is one,eight bit digital port on the ADR101 labelled PORT A. The individual I/O lines are labelled PA0-PA7. The following commands allow the user to;
-configure individual bits an input or output
-SET ot RESET individual bits
-read individual bits
-read entire port in binary or decimal format
-write to entire port in binary or decimal format.
The digital port commands are;
CPAxxxxxxxx Configures each bit of PORT A . All eight bits must be
specified. Order is MSB-LSB ( x=1 for input, x=0 for output )
example; CPA11110000
(PA7,PA6,PA5,PA4 are configured as inputs and PA3,PA2,
PA1,PA0 are configured as outputs)
SPAxxxxxxxx Outputs binary data to PORT A. All eight bits must be
specified. Order is MSB-LSB. Inividual bits configured
as input are not effected by this command. (x=1 or 0 )
example; SPA10101000
(PA7,PA5,PA3 are set, PA6,PA4,PA2,PA1,PA0 are reset)
RPA Returns status of all I/O lines in PORT A in binary format.
Order is MSB-LSB. Individual lines configured as output
will return last data set on the port.
example; RPA
0 1 1 1 0 0 1 0
(PA7,PA3,PA2,PA0 are low, PA6,PA5,PA4,PA1 are high)
RPAn Returns status of I/O line in PORT A specified by n.( n=0 to 7 )
example; RPA4
1
(PA4 is high)
MAddd Outputs decimal data (ddd) to PORT A. Individual lines
configured as input are not effected by this command.
(ddd= 000 to 255 )
example; MA255
( All lines of PORT A are set )
PA Returns status of PORT A in decimal format. Individual
lines configured as output will return last data set on
PORT A.
example; PA
128
(PA7 is high, PA6 thru PA0 are low)
RESPAn Resets I/O line specified by n in PORT A. This command
has no effect on I/O lines configured as input.
( n=0 to 7)
example; RESPA4
(PA4 is set)
SETPAn Sets I/O line specified by n in PORT A. This command has
no effect on I/O lines configured as input. ( n=0 to 7)
example; SETPA3
(PA3 is set)