![Pickering PXI 40-412 User Manual Download Page 25](http://html1.mh-extra.com/html/pickering/pxi-40-412/pxi-40-412_user-manual_1554975025.webp)
Page 4.5
32-CHANNEL DIGITAL I/O MODULE 40-412
pickering
SECTION 4 - PROGRAMMING GUIDE
Using the Direct I/O Driver or VISA Driver to control the 40-412
This section provides some code fragments which show how to control the 40-412 using either the Direct I/O Driver
or the VISA Driver.
nce the drivers are installed the manual
s Prg df and driver hel files which full descri es these functions
can e found in the Pickering folder s or the Pickering entries on our tart enu
The card must be opened before use and closed after using the following function calls:
Direct I/O Driver - Open with
PIL_OpenCards
or
PIL_OpenSpecifiedCard
and close with
PIL_CloseCards
or
PIL_CloseSpecifiedCards
respectively.
VISA Driver - Open with
pipx40_init
, and close with,
pipx40_close
.
Setting the output SINK driver states
Using the Pickering Direct I/O Driver:
DWORD SubUnit = 1;
//Sub unit 1 specifies sink drivers
PIL_ClearSub(CardNo, SubUnit);
//clear all sink driver channels to inactive
PIL_OpBit(CardNo, SubUnit, 5, 1); //set channel 5 to active
PIL_OpBit(CardNo, SubUnit, 5, 0); //set channel 5 to inactive
Using the VISA driver:
ViUInt32 SubUnit = 1;
//Sub unit 1 specifies sink drivers
pipx40_clearSub(vi, SubUnit);
//clear all sink driver channels to inactive
pipx40_setChannelState (vi, SubUnit, 5, 1); //set channel 5 to active
pipx40_setChannelState (vi, SubUnit, 5, 0); //set channel 5 to active
Setting the output SOURCE driver states:
These are programmed in the same way as the SINK drivers above but using sub unit 2
Setting threshold 1
12 bits of sub-unit 3 are used to program threshold 1 and 12 bits of sub-unit 4 are used to program threshold 2:
Using the Pickering Direct driver:
DWORD SubUnit = 3;
//Sub unit 3 specifies input threshold 1
double voltage = 25.0;
//set voltage to required threshold
DWORD Threshhold;
Threshhold = 4095*(voltage/50.0);
PIL_ClearSub(CardNo, SubUnit);
PIL_WriteSub(CardNo, SubUnit, &Threshhold);
Using the VISA driver:
ViUInt32 SubUnit = 3;
//Sub unit 3 specifies input threshold 1
ViReal voltage = 25.0;
//set voltage to required threshold
ViUInt32 Threshhold;
Threshhold = 4095*(voltage/50.0);
pipx40_clearSub(vi, SubUnit);
pipx40_setChannelPattern (vi, SubUnit, &Threshhold);