SECTION 4 - PROGRAMMING GUIDE
Page 4.5
pickering
GENERAL PURPOSE REED RELAY MODULE 50-110/115-021/121
Using pi40iv
The IVI driver has no special labelling for this card and treats the relays as an array of switches, labelling the
channels using com / nc / no labelling tags.
pi40iv_Connect(vi, “com1”, “no1”);
// Connects chA1 to com 1
pi40iv_Disconnect(vi, “com1”, “n01”); // Disconnects chA1 from com 1
Reconnects chB1 to com 1
pi40iv_Connect(vi, “com1”, “no6”);
// Connects chA6 to com 6
SPST and DPST versions use the simple com/ch labeling tags.
The IVI Switch driver specification contains no bulk setting capabilities.
Using PIPX40
setChannelState
ViUInt32 sub_unit = 1;
pipx40_setChannelState(vi, sub_unit, 1, VI_ON);
// Connects chA1 to com1
pipx40_setChannelState(vi, sub_unit, 1, VI_OFF);
// Disconnects chA1 from com1
Reconnects chB1 to com1
pipx40_setChannelState(vi, sub_unit, 6, VI_ON);
// Connects chA6 to com6
setChannelPattern
// Sub-unit is 64 bits wide, so 2 ViUInt32 values are needed to hold the entire pattern
ViUInt32 data[2];
data[0] = 1;
// Sets lowest bit to 1, chA1 to com1
pipx40_setChannelPattern( vi, sub_unit, data);
data[0] = 0x20;
// Sets 6th bit, chA6 to com6
// All other relays are set to off
pipx40_setChannelPattern( vi, sub_unit, data);
PROGRAMMING THE MODULE
Here are some simple examples of using the drivers with the 50-110-121 (64 Channel SPDT) module.
Using PILPXI
To operate a relay the user could use the simple OpBit command or the WriteSub commands
OpBit
DWORD sub_unit = 1;
PIL_OpBit( card_num, sub_unit, 1, 1); // Connects channel A1 to com 1
PIL_OpBit( card_num, sub_unit, 1, 0); // Disconnects channel A1 from com 1
Reconnects channel B1 to com 1
PIL_OpBit( card_num, sub_unit, 6, 1); // Connects channel A6 to com 6
WriteSub
// Sub-unit is 64 bits wide, so 2 DWORDs are needed to hold the pattern
DWORD data[2];
data[0] = 1;
// Sets lowest bit to 1, channel A1 to com 1
PIL_WriteSub( card_num, sub_unit, data);
data[0] = 0x20;
// Sets 6th bit, channel A6 to com 6
// All other relays are set to off
PIL_WriteSub( card_num, sub_unit, data);
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com