
Page 4.4 pickeringtest.com
Section 4 - Programming
Programming the Module
This section provides some code fragments which show how to control the 4x-878 multiplexer using either the Direct I/O
Driver or the VISA Driver.
Once the drivers are installed the manual “Sys40Prg.pdf” and driver help files which fully describes these functions can be
found in the Pickering folder(s) or the Pickering entries on your Start Menu.
The card must be opened before use and closed after using the following function calls:
Direct Driver - Open with PIL_OpenCards or PIL_OpenSpeciedCard and close with PIL_CloseCards or
PIL_CloseSpeciedCards respectively.
VISA Driver - Open with pipx40_init, and close with, pipx40_close.
Using the Pickering Direct I/O driver:
DWORD sub_unit = 1; // Select Bank 1
PIL_OpBit( card_num, sub_unit, 1, 1); // Enable the C1 to 1 signal path
PIL_OpBit( card_num, sub_unit, 2, 1); // Release the C1 to 1 signal path and
// enable the C1 to 2 signal path
PIL_OpBit( card_num, sub_unit, 2, 0); // Release the C1 to 2 signal path and set
// the multiplexer to the default position
Using the VISA driver:
ViUInt32 sub_unit = 1; // Select Bank 1
pipx40_setChannelState(vi, sub_unit, 1, VI_ON);
// Enable the C1 to 1 signal path
pipx40_setChannelState(vi, sub_unit, 2, VI_ON);
// Release the C1 to 1 signal path and
// enable the C to 2 signal path
pipx40_setChannelState(vi, sub_unit, 2, VI_OFF);
// Release the C1 to 2 signal path and
// set the multiplexer to default
Using the IVI driver:
The IVI driver has no special labelling for this card and treats the array of switches as a simple array, labelling the channels
using the normal com./ch labelling tags (banks are labelled in sequence, 1 is A, 2 is B, 3 is Cand Dis 4. The following
example assumes a two or four bank multiplexer, for single bank versions, the common is referred to as com, and the
channels as ch1, ch2, etc.
pi40iv_Connect(vi, comA, chA1); // Enable the C to 1 signal path of bank 1
pi40iv_Disconnect(vi, comA, chA1); // Release the C to 1 signal path of bank 1
pi40iv_Connect(vi, comA, chA2); // Enable the C to 2 signal path of bank 1
pi40iv_Disconnect(vi, comA, chA2); // Release the C to 2 signal path and sets
// multiplexer bank 1 to the default position