Using Matlab with Pickering PXI Direct IO drivers

    Return to Matlab landing page

    As the Pickering drivers are standard Windows dll's, it can be accessed from most programming languages and MATLAB like other programming languages have capability to load and run Pickering drivers to control PXI cards. Functions such as) opening/closing cards(s) and operating switches can be performed using a set of instruction (listed below).

    The functions can either be executed directly on MATLAB workspace or in function (*.m) files.


    Loading Libraries

    To access the library, please use the "loadlibrary" function, here is an example to access the PXI driver PILPXI

    loadlibrary('Pilpxi','<PATH_NAME>\Pilpxi.h');
    %% Enter appropriate pathname for dll.

    Once the libraries are loaded, in order to check the functions in the library use "libfunctionsview" command followed by the dll's name.

    Lets take an example of PILPXI

    libfunctionsview('Pilpxi');

    The following window will appear displaying information on functions in external library


    Open Specified Card

    Once the library is loaded, user can now use PIL_OpenSpecifiedCard function to open a specific PXI card in the chassis. This can be achieve by using the "calllib" function as shown in the example below

    %% Create a uint32Ptr to get a return value on logical card number
    cardnum=libpointer('uint32Ptr', 0);
    %% Enter the input parameters for PIPLX_connect
    %% Enter the SessionId obtained when connected to PXI card
    %% Set the BUS and SLOT to the address of the card.
    calllib('Pilpxi', 'PIL_OpenSpecifiedCard', BUS, SLOT, cardnum);
    
    %% If the ans = 0 (No error returned) the card is successfully opened
    CardNum=cardnum.Value;
    %% Return the value of card number

    Operating Switches

    Once the card is open, user can now able to operate switches. PIL_OpBit allows user to operate switch one at a time. If it's a matrix, please use PIL_OpCrosspoint. Here is an example

    %% Enter the input parameters for PIL_OpBit
    %% OutSub - Output Sub Unit number
    %% BitNum - Output Bit number
    %% state - "1" ON , "0" OFF
        
    calllib('Pilpxi', 'PIL_OpBit', CardNum, OutSub, BitNum, State); 

    Close Specified Card

    To close a specific card, please use PIL_CloseSpecifiedCard function

    %% Enter the current session ID and card number in the input parameters
    calllib('Pilpxi','PIL_CloseSpecifiedCard', CardNum);

    Unload Libraries

    To unload library use the following command

    unloadlibrary('Pilpxi');

    Need help?



    Support knowledgebase

    Have questions or need some help? While we enjoy talking to you, you can find technical information for our entire product range here.

    Technical know-how 


    Long-term support

    Because we manufacture our products in-house, we are able to provide you with guaranteed long-term support and low obsolescence.

    Our support


    Resource center

    From success stories and product literature to newsletters, find the information you need about our switching and simulation solutions.

    Get the resources you need


    Worldwide presence

    We supply and support our products across the globe, with seven offices in the Americas, Europe and Asia as well as additional representation. 

    Find a local office or agent near you