Manual 104-IIRO-8(E)
14
RELAY OUTPUTS
At power-up, all relays are initialized in the de-energized state. The relay outputs are controlled by writing to the
Base Address. Data are written to all eight relays as a single byte. Each bit within the byte controls a specific
relay. A "1" energizes the corresponding relay and a "0" turns it off.
Bit
Position D7 D6 D5 D4 D3 D2 D1 D0
Relay Contr'd
OUT7
OUT6
OUT5
OUT4
OUT3
OUT2
OUT1
OUT0
For example, if bit D5 is turned on by writing hex DF to the base address, then the relay that controls OUT5 is
energized closing the associated normally-open contacts. All other relays would be de-energized and their
normally-closed contacts would be closed.
PROGRAMMING EXAMPLES
No driver software is provided with the board because programming is very simple and can be accomplished
most efficiently using direct I/O instructions in the language that you are using. The following examples are in C
but are readily translated into other languages:
Example: Turn on OUT0 and OUT7
Base=0x300
//Base
I/O
address
outportb(Base,
0x7E);
Example: Read back the state of the relays
X=inportb(Base);
//relay register data to X
printf(“%02x”);
//display
results
Example: Read the digital inputs
Y=inportb(Base+1);
//digital input register to Y
SOFTWARE
Utility software provided on CD with the board is the base address locator, an illustrated setup program and a
sample program. The sample program sequentially turns on each relay until all
are on and then sequentially turns them off. After each relay is turned on, the
relay states are read back, the opto-isolated inputs are read, and the data are
displayed.
The sample programs are in forms suitable for use with, QuickBASIC, C, and Pascal. The programs as follows:
FINDBASE:
Program locates active and available port addresses.
SETUP:
Board
Setup
Program
CSAMPLES: SAMPLE1 This sample program will sequentially turn on all bits of the relay input and
sequentially turns them off. Each time it sets a new bit, both the relay output and
the relay input are read and the data displayed. This demonstrates how to read
and write to a port.
BSAMPLES:
SAMPLE1Same
sample in Quickbasic