Accessing Pickering Drivers from Python

Pickering drivers are standard Windows dll's and as such can be accessed from most programming languages, including Python.

To access a library, use the ctypes library, here is an example of access to the non-VISA driver PILPXI:

At the command line


from ctypes import *
 
pilpxi = windll.LoadLibrary("pilpxi")
 
ver = pilpxi.PIL_Version()

A Python Library for PILPXI

An implementation of the library is provided here

It contains 2 class definitions:

  • pilpxi_base

    contains non card-specific functions to locate PXI cards

  • pilpxi_card

    contains all the card -specific functions to access and control Pickering PXI cards

Example:

from pilpxi import *
 
base = pilpxi_base()
 
e, count = base.CountFreeCards()
e, bus, slot = base.FindFreeCards(count)
 
cardnum = 0
while cardnum < count:
 
    card = pilpxi_card(bus[cardnum], slot[cardnum])
 
    err, cid = card.CardId()
    print "Card ",cardnum
    print "Bus", bus[cardnum], " Device", slot[cardnum]
    print "ID = ", cid
    e, ins, outs = card.EnumerateSubs()
    print "subunits: ", ins, "input, ", outs, "output"
 
    sub = 1
    while sub <= outs:
        e, inf = card.SubType(sub, 1)
        print "subunit ",sub, " = ", inf
        sub = sub + 1
        cardnum = cardnum +1
 

In this example, pilpxi_base is used to locate all available cards. CountFreeCards returns the number of cards found, then FindFreeCards returns two arrays containing the bus and device numbers of the cards.

Next pilpxi_card is used to open each card and then basic card information is queried and the type of each subunit presented.

For basic details of the functions available the user is referred to pilpxi documentation.

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 videos,
to product literature and 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