Page 4.4
6-CHANNEL BATTERY SIMULATOR MODULE 41-752
pickering
SECTION 4 - PROGRAMMING GUIDE
SET AND READ BACK A SINK CURRENT
C code example using the Direct Driver (requires Pilpxi.h and Pilpxi.lib found in the Pickering folder structure)
DWORD
l_CardNum;
//assumed you have opened the card using OpenCards() or OpenSpecifiedCard()
DWORD l_SubUnit;
double l_Val;
SubUnit
=
3;
//Select
the
3rd
channel
l_Val
=
.03;
//request
to
sink
.03Amps
l_RetCode = PIL_BattSetCurrent(l_CardNum, l_SubUnit, l_Val); //select the Sink Current in l_Val
l_RetCode = PIL_BattGetCurrent(l_CardNum, l_SubUnit, &l_Val);//get the current sink current l_Val
//rounded
to
nearest
obtainable
value
SubUnit
=
0;
//Select
all
channels
l_Val
=
.03;
//request
to
sink
.03Amps
l_RetCode = PIL_BattSetCurrent(l_CardNum, l_SubUnit, l_Val); //select the Sink Current in l_Val
READ THE INTERLOCK STATE
C code example using the Direct Driver (requires Pilpxi.h and Pilpxi.lib found in the Pickering folder structure)
DWORD
l_CardNum;
//assumed you have opened the card using OpenCards() or OpenSpecifiedCard()
DWORD l_SubUnit;
double l_Val;
BOOL l_InterlockState;
SubUnit
=
0;
//0
to
6
returns
the
same
value
l_RetCode = PIL_BattReadInterlockState(l_CardNum, l_SubUnit, &l_InterlockState);
//Battery
interlock
state
CALIBRATION
The 40-752 is calibrated before leaving Pickering, but periodically you may want to re-calibrate this device. This
can be carried out very simply using the “Soft Front Panel” provided, alternatively you may wish to code your own
program to achieve this. Calibration is the only process which requires use of the raw binary functions described
later in this section.
C code example using the Direct Driver (requires Pilpxi.h and Pilpxi.lib found in the Pickering folder structure)
DWORD
l_CardNum;
//assumed you have opened the card using OpenCards() or OpenSpecifiedCard()
DWORD l_SubUnit;
DWORD l_CalInd;
DWORD l_Val;
//DWORD l_WriteEnable;
SubUnit
=
3;
//calibrating
the
3rd
channel
l_RetCode = PIL_BattSetEnable(l_CardNum, l_SubUnit, 1);
//enable the output for channel 3
//this would also enable channel 3 output using a raw write to sub unit 13
//l_WriteEnable = 0x0004;
//bit 3 on = enable channel 3 only
//l_RetCode = PIL_WriteSub(l_CardNum, 13, &l_WriteEnable); //raw write