User`s manual

XP8300/XP8400/SE110084 s Advanced Programming
Controlling a Relay
Once a relayî‚’s address is placed on the bus (the most recent address on the
bus remains in effect), relays can be switched indefinitely. Use the
BUSWR bus cycle to place four bits of data on the bus. Table D-1 shows
the relay physical addresses and states.
A formula for turning on a relay is
relay# << 1 | 1
The following code fragments illustrate how to turn on a relay using this
formula for a BL1200, PK2200, or PK2100.
#define ON 1
#define OFF 0
#define BOARD 0x0301 // board address is
// 0x0103
#define REL3 6 // 3 << 1 = 6
set12adr( BOARD ); // select the board
outport( BUSWR, REL3|ON ); // turn relay 3 on
(or)
write12data( BOARD, REL3|ON );
For a BL1100 or BL1000 use the following code.
#define ON 1
#define OFF 0
#define BOARD 0x0301 // board address is
// 0x0103
#define REL3 3
PBus_Addr( BOARD ); // select the board
PBus4_Write( REL3|ON ); // turn on relay 3
Table D-1. Relay Addresses and States
Data Bits
Relay
D3 D2 D1 D0
0 0 0 0 0 = relay off
1 0 0 1 1 = relay on
2 010
3 011
4 100
5 101
6 110
7 111