Home

Using the VISA Driver Development Wizard and NI

image

Contents

1. When you have added all the steps for your device click the Next gt button to continue with the wizard 3 5 Output Files Properties http Zone ni cony devzone conceptd nsf webra 86256B 5600642A C7 opendocument amp node dz00000_us 60 0 142005 5 18 O 10 53 56 Using the VISA Driver Developrrent Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments After you have entered all interrupt information the Output Files Properties window appears as shown in Figure 7 YISA Driver Development Wizard PXI Output Files Properties Thanks for using the YISA Driver Development Wizard This wizard will now generate the necessary tiles based on the information you have entered Please specify the filename prefix and the output directory If you are creating a distribution kit for your driwer or application You need to install the appropriate JNF file depending on the operating system The distribution kit that Labw indows Cwl creates for WI and Velpnp drivers does this automatically Rel Instrument Prefix PXIBO OE Directory for Output Files C VXIpnp winnt PXI60706 Browse The following files will be generated Cel pap winint PesTBO FOE SPAsIG0_F Tint CV pap winnt PIBO FOE SPAst6O0F0E 3s int CVelpnpwinntPesIBO FOE SPIO OE NT 4 inl LVelpnpwinntPesibO DE SPesIbO OE NT Srl CAW pnp winnt PestbO DE SPesIBO OE ir Back Cancel Help Figure 7 Output Fil
2. con devzone conceptd nsf webra 86256B 5600642A C7 opendocument amp node dz00000_us 80 0 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments PX12 13 INSTR PXI 6070E Measurement amp Automation Explorer Sime File Edit View Tools Help i i FA Operi VISA Session g Save yP Show Help Y My System E Data Neighborhood Ba Pie 4 2INSTR Q Devices and Interfaces Traditional NI DAQ Devices GPIBO PX1 GPIB HPAI PHI System NI PXI 8186 PC Device Number Chassi PCI Function Number PCI Bus Number P Device Information O nINSTR PxI 541 14 Manubacturer HM ational Instruments 011093 HG IMSTR PsI GPIB Model Pl B070E 021760 i Ports Serial amp Parallel RIO Devices Device Location 4 Scales Chassis fa Software Clot ia IVI Drivers Local Bus Left xY Remote Systems Local Bus Aight Trigger Bus Slot Path al fe General Ha Pal Settings Figure 9 PXI 6070E as a NI VISA Device in MAX Note If you have disabled the Passport for PXI devices in VISA you need to reenable the Passport for VISA to recognize PXI devices In Figure 8 notice there are several attributes specified to the right of our PXI device listing in MAX The attributes listed under Device Information were set in the INF file by the VISA Driver Development Wizard Now that our PXI device is visible
3. C7 0pendocument amp node dz00000_us 140 0 142005 5 18 O 10 53 57
4. Is necessary to allow A VISA to control your Pel or PEI device Please enter the basic device Information below This wizard will generate AF files for Windows 96yMe Windows AT Windows amp Pe2U00 and LabVIEW AT The JAF file tells the operating system to allow NI VISA to access the Pel or PCI device that you specify below Pel Manufacturer ID Subsystem ManutacturerlO Manufacturer Name D1 093 00000 N ational Instruments Pel Model Code Suberstem Madel lode Model Name 0x1 1B0 HOO PxI 6070 Device uses subsystem a Generates interrupts Load settings from Module Description File View or change loaded settings before generating files Back Cancel Help Figure 2 Basic Device Information Using this window you can specify the following basic information PXI Manufacturer ID This 16 bit value identifies your device when it is installed It is vendor specific and unique among PCl based device providers For example the Manufacturer ID number for National Instruments is 0x1093 PXI Model Code This 16 bit value identifies your device when it is installed It is device specific and defined by the instrument manufacturer The model code for the PXI 6070E which we use for our examples is 0x11B0 Generates interrupts Some PXI PCI devices generate interrupts to request attention Checking this box indicates that you need to use the VISA event handling model in response to hardware interru
5. NI VISA API See the code below for the details of calling the viOpen function in LabWindows CVI http Zone ni com devzone conceptd nsf weom 6256B 5600642A C7 0pendocument amp node dz00000_us 100 0 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments includ lt ane1c h gt To program FET devices you must define the following MAFO before 4 you include the library visa h Hit detined NIVISA PAT tdf ine HIVISA PXI emi 4 TInclde the VIo4 library Finclide vies hh int main fint argc char ergv 1 Vewlable declaratie Willint 32 weiteValue Willlnt 32 ber Feee Willintl6 modelo Villlnt16 mennufacturer ID Tissin pe 070E ViStatue statue Witess1on def aul thy Widder address Widder adiresi fet int of fet Open and Initialize the PHT 6070E f pen the HI VIS4 driver statue viOpenDefaultRM f idefaultky f pen a 1m to the PHI SUVUE using ite VISA resource Af name string PHI1 10 INSTR status vi0oen fdefaultRH FHI1 10 INSTR VI NULL VI HULL apal 6 OE Obtain the menutacturer s ID and models code wiletattribite 1607 0E VI ATIE MAWF ID d4manutecturer LD wiletattribute m1607 0E VI ATIE LEL ODE model ode Statue Satatue Verity we heave a FPH 6070E LitmanutacturerlD 01093 retum l ti fmodelicde e116 return L 4
6. PXI PCI and USB devices When the wizard opens it displays the Hardware Bus window as in Figure 1 YISA Driver Development Wizard Hardware Bus Welcome to the YISA Driver Development Wizard The wizard gathers the information that is necessary to allow NI YISA to control your device Please select the hardware bus which your device will use Hardware Bus Figure 1 Hardware Bus Window Because we want to control a PXI or a PCI device select PXI PCI and select the Next gt button For more information about controlling a USB device see Using NI VISA 3 0 to Control Your USB Device in the related links section 3 2 Basic Device Information The wizard first prompts for basic information NI VISA needs to properly locate and identify a PXI PCI device This basic information such as manufacturer s identification and model code should be documented in the register level programming information for your PXI PCI device Figure 2 shows the Basic Device Information window of the VISA Driver Development Wizard http Zone ni con devzone conceptd nsf webra 86256B 5600642A C7 opendocument amp node dz00000_us 20 0 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments YISA Driver Development Wizard PXI Basic Device Information Welcome to the IS4 Driver Development Wizard for Pll The wizard gathers the information that
7. functions are introduced below For details on using high level and low level functions to access registers on a device see the Register Based Communication section in the NI VISA Help for more information Once we have initialized and opened a session to the PXI device register peeks and pokes turn on a few of the digital lines on the device Figure 12 is a LabVIEW block diagram demonstrating how to use VISA to write data to the registers of a PXI device This LabVIEW example turns on some of the digital lines on the PXI 6070E Because the values of the registers in the example are specific to the PXI 6070E we will not go into detail as to why the specific register accesses are used In this VI the Low Level Register Access operation VISA Poke writes a 16 bit value to a register When using low level access operations a hardware window must be set up using VISA Map Address or viMapAddress to obtain a pointer to access the specified address space You must specify the address space the offset and the window size within this space you would like to access In our example the address space is BAR1 the offset is 0 and the size is 0x1000 Refer to Figure 11 for a text based example of this function B gt esenesDigOut vi Diagram ESeries Digut x0 Figure 12 eseriesDigOut vi Once the window is properly mapped the Poke function can write the appropriate values to the desired registers Notice in Figure 12 that the address space is se
8. in our example This input would be supplied if our eseriesInit vi was used in sequence as a subVI with other subVIs that may need to pass in an error VISA attributes are a common way to access information about a device or its configuration In the above examples VISA attributes query the manufacturer ID and the model code of a PXI device to make sure the VISA session has been opened to the correct PXI device In LabVIEW a Property Node reads or writes VISA attributes for a device in a text based language viGetAttribute performs the same function See the NI VISA Help for more specific information about obtaining and configuring VISA attributes 4 2 Step 2 Communicating with the PXI Device The final two steps in Figure 10 are specific to the PXI 6070E initialization A property node obtains the base address of the BAR1 register This value is then compared with the value 0x80 using a logical OR The result is written to BARO space at offset OxCO To do this we call the High Level Register Access function VISA Out 32 which writes a 32 bit value to the specified memory space at the specified offset We use the decimal value 11 as an input to this VI to specify BARO as the address space to write to As shown in Figure 11 the same operations are performed using the viGetAttribute and viOut32 functions in a text based language There are several High Level Register Access functions for writing data to registers memory space in NI VISA Some of these
9. is AUK release on acknowledge and the required register was already read this page may be blank Add a step before Add a step after Edit a step Remove a step Back Cancel Help Figure 5 Interrupt Removal Information Just as recognizing an interrupt may take multiple steps acknowledging an interrupt may also take multiple steps To add a step click the Add a step before or Add a step after button The steps to remove the interrupt from your PXI PCI device should be in the register documentation for your device After selecting one of the Add a step buttons the PXI Interrupt Information window appears In Figure 6 we have specified that to remove the interrupt we must write a 16 bit value to BARO at offset 0x10 The Value to write or compare is the value we are going to write to the 16 bit register Again this information is provided for example purposes only and is not useful if attempting to handle interrupts for the PXI 6070E Click OK when you finish entering a particular interrupt detection step NI YI5SA PZI Interrupt Information Type of access Width of access Word 16 bit X Address space Offset within space BARO Jaxo00000 0 Compare mask Value to write or compare e0000 OsDED OF Cancel Help Figure 6 Interrupt Information There may be more than one step documented for your device If this is the case you continue to add steps until the sequence for your device is complete
10. Device Information window as well as information on interrupt detection and interrupt acknowledgment If you already have a module ini file for your PXI device you can load the information directly from the INI file using the Load settings from Module Description File button View or change loaded settings before generating files Once the information is loaded from the module ini file this information can be reviewed and edited or accepted If you want to review the interrupt information contained in the module ini file before generating the INF http Zone ni con devzone conceptd nsf webrra 86256B 5600642A C7 opendocument amp node dz00000_us 30 0 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments files select the View or change loaded settings before generating files checkbox If this checkbox is not selected you do not need to enter any more information about your PXI instrument Note The View or change loaded settings before generating files checkbox is enabled only if the settings were loaded from a Module Description File To obtain the values for these settings contact your PXI PCI device manufacturer Along with the INF files the VISA Driver Development Wizard also creates a module ini file that you can distribute with your PXI instrument When all information is loaded click the Next gt button The next wi
11. Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments NATIONAL view cart help search NI Developer Zone INSTRUMENTS eects Products amp Services Solutions Support Ni Developer Zone Academic Events Company Using the VISA Driver Development Wizard and NI VISA to Register Level Program a PXI PCI Device under Windows Back to Document You can use NI VISA to program PCI and PXI PCI eXtensions for Instrumentation devices installed in a PC or a PXI chassis Users writing an application for a PCI or PXI device with NI VISA gain full access to the device configuration including I O and memory mapped registers NI VISA programming is available under selected Windows OSs and the LabVIEW Real Time Module Table of Contents e 1 Scope of This Document e 2 PXI and VISA Background e 3 Configuring NI VISA to Recognize a PXI PCI Device e 4 Using NI VISA to Communicate with a PXI PCI Device e 5 Using NI VISA to Handle Events from a PXI PCI Device e 6 Using LabWindows CVI to Install Your Device INF Files e Summary 1 Scope of This Document This document provides an introduction to using NI VISA and the VISA Driver Development Wizard DDW to develop a low level driver for a PXI PCI device This document provides the reader with the basics of the NI VISA features that can be used to register level program PXI PCI device
12. ed the interactive control panel you left click on the pull down menu under the Resources to Find textbox and select Create Query Here you check the resources or attributes you want to have specified in your regular expression and it creates the regular expression for you For more information on VISA resources VISA resource names and NI VISA programming see the NI VISA Help which should have been installed on your system with the full development version of NI VISA 4 Using NI VISA to Communicate with a PXI PCI Device Now that we can communicate with our device using NI VISA we will demonstrate a simple programming example to get you started programming your device using the NI VISA API In our example we program the PXI 6070E to toggle a few of its digital lines We demonstrate how to open a VISA session map a portion of memory peek and poke registers on the device and close the VISA session both in LabVIEW and in LabWindows CVI NI VISA provides high level and low level register accesses The valid address spaces for a PXI device are the configuration registers VI_PXl_CFG_SPACE and the six Base Address Registers VI_PXI_BARO SPACE VI_PXIl_BAR5 SPACE A device may use any or all of the BARs This information is device dependent but can be queried through the VISA attributes VI_ATTR_PXl_MEM_TYPE_BARO VI_ATTR_PXlLMEM_TYPE_BARBS The values for these attributes are none 0 memory mapped 1 or I O 2 If the value is memory mapped o
13. ed to compare in this case bit 31 The hexadecimal value that corresponds to bit 31 being high is 0x80000000 The Value to write or compare is the value that we expect the 32 bit register to be equal to after applying the mask If we were doing a Write instead of a Read Compare we would use this value to specify what should be written back to the register Again this information is provided for example purposes only it is not useful if attempting to handle interrupts for the PXI 6070E Click OK when you finish entering a particular interrupt detection step When you have added all steps for your device click the Next gt button to continue with the wizard 3 4 Interrupt Removal Information If the Generates interrupts box was checked the next window is the Interrupt Removal Information window Once an interrupt is detected it must be acknowledged and removed from the bus Using this window you can specify the steps required to acknowledge the interrupt http zone ni conydevzone conceptd nsf webnea 86256B5600642A C 770pendocunent amp node dz00000 us 50 0 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments YISA Driver Development Wizard PXI Interrupt Removal Information p Specity the step needed to acknowledge an interrupt from your device The intent is to remore the interrupt condition from the PEI bus IF the device
14. emove Sequence Offset_ Ci om ID are Sanne 4 UURmannndnn AAAA Add a step before Add a step after Edit a step Remove a step Back Cancel Help Figure 3 Interrupt Detection Information For the purposes of determining whether your device is asserting a hardware interrupt a Read Compare operation exists This operation performs a register read applying a user defined mask logical AND to the register contents The resulting value is then compared with a user specified constant using another logical AND If the masked result and the user defined constant are the same the comparison operation is said to be True If the values are different the result is False If the result of all Read Compare operations in a sequence of register transactions is True NI VISA concludes that your device is interrupting and proceeds to execute the Interrupt Acknowledge sequence Because NI VISA relies on the comparison operations result in making this conclusion at least one Read Compare operation must be present in this transaction sequence You can add steps to the sequence using the Add a step before and Add a step after buttons Figure 4 shows the window that appears if you click one of the Add a step buttons http Zone ni con devzone conceptd nsf webra 86256B 5600642A C7 opendocument amp node dz00000_us 40 0 142005 5 18 O 10 53 56 Using the VISA Driver Developrrent Wizard and NI VISA to Register L e under Windows T u
15. er is run on a target machine the installation script handles the extra steps necessary to register the PXI device with NI VISA You should install the your device driver before you install your PXI device If a PXI device is installed before the INF file Windows marks the device as Unknown and may not properly associate the NI VISA driver with it 7 Summary Traditionally the only way to program a PXI PCI device was to write a kernel level driver You can use NI VISA as the low level kernel level driver This way the programming can concentrate on the high level functionality of the device itself To detect install and communicate with a PXI PCI device Windows needs a INF file The VISA Driver Development Wizard can create and install this file automatically Once a PXI PCI device is properly installed using the INF file from the Driver Development Wizard you can use the NI VISA API to program that device The VISA API contains functions such as viPoke viOut and viMove which you can use to access registers on a PXI PCI device The VISA Event Handling Model handles events They can be handled synchronously using the queuing mechanism or asynchronously using the callback mechanism Related Links Using NI VISA 3 0 to Control Your USB Device Product Manuals NI VISA Programmer Reference Manual Product Manuals NI VISA User Manual My Profile Privacy Legal Contact NI http Zone ni com devzone conceptd nsf weom 6256B 5600642A
16. es Properties The PXI Instrument Prefix is a descriptor you use to identify the files used for this device Enter a PXI Instrument Prefix select the desired directory in which to place these files and click Next gt The INF file is created in the directory specified by the output file directory and the Installation Options windows appears as in Figure 8 3 6 Installation Options You should now have all the required Windows Setup Information INF files for each applicable Windows OS Before a device is visible to NI VISA you must use the INF files to update the Windows system registry Beginning with NI VISA 3 1 the Driver Development Wizard can automatically install the INF file for your device To automatically install the required files select Install the setup information file for this operating system for me and click Finish http zone ni con devzone conceptd nsf webra 86256B 5600642A C7 opendocument amp node dz00000_us 70 0 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments IS4 Driver Development Wizard Installation Options The information you provided has been parsed and the resulting setup information files have beer placed in your Vl pnp directory C ETF the setup information file to a LabviEwW AT system on the network Take me to the folder containing the generated files i Do nothing m
17. f Stere to initialize the MITE sic These are specific to initializing the HAI 60 0E we wll mot go into Af dete about these stepe status viletattribuite p160 0E VI ATIE FXI MEM BACK BAR Aber Ase writeValue fherlbeee Oe80 statue vidut pe 600E 11 Osl0 writeValiwe A HEp the blok of memory we yill write to uzirg woke fad obtain a pointer to this renary statue viMeap dcres s p16070E 12 0 1000 UO VI HULL daddies 7 Wite the velue to the registers viel pen b0F 0E address O28 offset int jaddress offset offset Ux Figure 11 LabWindows CVI Example There is one key difference between the LabVIEW example and the LabWindows CVI example The LabWindows CVI example calls viOpenDefaultRM This function must be called once at the beginning of every NI VISA based application to open and initialize the VISA driver The handle to the driver session opened here is passed to subsequent calls to viOpen to open sessions to specific devices It is not necessary to explicitly call viOQoenDefaultRM in LabVIEW because LabVIEW automatically calls it whenever a VI uses VISA The error in http Zone ni com devzone conceptd nsf weom 6256B 5600642A C7 opendocument amp node dz00000_us 110 Q 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments input in the diagram of Figure 10 is an optional input
18. indows CVI function is viWaitOnEvent When using these functions a program waits for a specified amount of time for the event to be placed in the VISA event queue The program pauses in this function until the event occurs or the function times out When the specified event occurs specific information about the event is passed back via this function 5 2 Callback Mechanism The callback mechanism is available in LabWindows CVI but not in LabVIEW This technique involves having a section of code called automatically by the VISA driver whenever a particular event occurs The function invoked if a particular event occurs is called a callback function The callback mechanism is useful when your application requires an immediate response It is possible to use both queuing and callbacks in the same application When using callbacks you must associate an interrupt handling function with a particular event before you enable events using the function viEnableEvent The function you use to associate a handler with an event is vilnstallHandler After calling this function and then enabling events the function you have specified using vilnstallHandler is called asynchronously when the interrupt occurs 5 3 Event Functions There are a few important functions to be familiar with when using events in VISA The first two functions enable or disable the event handling mechanism in NI VISA The LabVIEW function VISA Enable Event and the LabWindows CVI functi
19. m the VISA Resource Name variable would be passed in from the previous Vis used to communicate with the device In the LabWindows CVI example of Figure 11 the viClose function closes the VISA session to the PXI device This function must actually be called twice once to close the session to the PXI device and once to close the session to the VISA driver For more detailed information on closing VISA sessions see the NI VISA Help 5 Using NI VISA to Handle Events from a PXI PCI Device Often PXI PCI devices use interrupts to request service from the system VISA handles an interrupt from a device using its event handling model There are two mechanisms for handling events in the NI VISA event handling model the queuing mechanism and the callback mechanism 5 1 Queuing Mechanism You can use the queuing mechanism in LabVIEW and LabWindows CVI With this technique all occurrences of a specified event are placed in a queue Your program can periodically poll the queue for event information or pause the program until the event has occurred and has been placed in the queue The queuing mechanism is generally useful for noncritical events that do not need immediate attention because you must explicitly poll for the occurrence of an event When using the queuing event handling mechanism the event queue must be polled manually to determine which events have occurred The LabVIEW function to do this is VISA Wait on Event and the corresponding LabW
20. n32 installation package for your PXI instrument The Create Distribution Kit menu lists several options for customizing an instrument driver installation For VISA based PXI instrument drivers follow these steps to create the distribution kit 1 Generate the INF files for your instrument using the VISA Driver Development Wizard as previously discussed in section 2 The files are named lt prefix gt lt os gt where os is one of the following _9x Windows Me 98 95 _nt4 Windows NT 4 _nt5 Windows 2000 XP and _ rt LabVIEW Real Time Maintaining these exact file names is important when using LabWindows CVI to generate a distribution kit 2 Open LabWindows CVI and select Create Distribution Kit from the Build menu 3 From the LabWindows CVI Create Distribution Kit dialog choose Add Group to create a new file group for the PXI INF files You must name this group PXI Setup Files 4 The next dialog box prompts you for the files to add to the PXI Setup Files group Add all the INF files generated by the VISA Driver Development Wizard 5 Verify that the Group Destination for the PXI Setup Files group is the Application Directory Also verify that the Relative Path is not enabled unchecked 6 Click Build to create the distribution kit LabWindows CVI generates a set of installation files including setup exe for your driver You should redistribute all the files it creates including the msi and cab files When this install
21. ndow depends on whether you checked the Generates interrupts and View or change loaded settings before generating files boxes If your device does not generate interrupts you can skip to section 3 5 Output Files Properties If you loaded the settings from a module description file and did not check the View or change loaded settings before generating files box you can skip to section 3 6 Installation Options 3 3 Interrupt Detection Information If the Generates interrupts box is checked the next window is the Interrupt Detection Information window Because PXI PCI devices share one of four physical interrupt lines more than one PXI PCI device can be interrupting at any given time In the Interrupt Detection window you specify the sequence of register operations so that NI VISA can determine whether your device is interrupting PXI PCI hardware typically indicates a pending interrupt condition using an Interrupt Status Control register Figure 4 shows the Interrupt Detection Information window VISA Driver Development Wizard PXI Interrupt Detection Information Specify the steps to determine whether your device is generating a given interrupt The sequence Is considered successtul true only if all Compare steps match There must be at least one such Compare step in each sequence Al least one sequence must be considered successful true for the interrupt to be deemed to belong to this device Sequence 0 Add Sequence R
22. on viEnableEvent tell the VISA driver to begin waiting for a particular event The call to enable a VISA event must specify the VISA resource to monitor for events the type of event you want to acknowledge and which event handling mechanism to use In the case of PXI PCI devices the type of event you enable is the VI EVENT PXI_INTR This event tells VISA to place events from that particular PXI PCI device in the queue or to use a http Zone ni com devzone conceptd nsf weom 6256B 5600642A C7 0pendocument amp node dz00000_us 130 0 142005 5 18 j O 10 53 57 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments specified callback function when the event occurs The LabVIEW function VISA Disable Event and the LabWindows CVI function viDisableEvent tell the VISA driver to stop handling the specified type of events from the specified device For more detailed information about setting up and handling PXI PCI interrupts see the Events section in the N VISA Help 6 Using LabWindows CVI to Install Your Device INF Files To run your PXI application on a target machine you must include the INF files generated in your PXI application installer or you must install these files manually LabWindows CVI is a convenient development environment for creating an installer package to redistribute VX plug amp play or IVI instrument drivers LabWindows CVI can also generate a Wi
23. ore and exit the wizard The option to FTP the appropriate file to a Labview AT pstem is available only if vou are generating a Pel PCl file and have Labview AT installed fF wou choose this option you will specify the FTP parameters on the next page of the wizard Back Cancel Help Figure 8 Installation Options The procedure for using an INF file to update the registry is Windows version dependant To manually install an INF file on any machine including the one on which it was generated open the appropriate INF files in a text editor such as Windows Notepad and follow the instructions on the first few lines at the top Note Only one driver should be associated with any particular PXI PCI device in your system If you are following our example with the PXI 6070E for Windows to recognize NI VISA as the driver for your device you need to make sure that NI DAQ is not installed on the system You also need to be sure that any registry information about the old driver is removed You may now install your hardware in the system Depending on your OS this process may be slightly different Once the hardware and setup information is properly installed we should see the device through Measurement amp Automation Explorer MAX Open MAX and press lt F5 gt to refresh Figure 9 shows what is visible in MAX once we properly install the INF file we created using the wizard under Windows XP for our PXI 6070E http Zone ni
24. pts your PXI PCI device generates For the purposes of demonstrating the VISA Driver Development Wizard we have checked the Generates interrupts box although we do not show examples using interrupts on the PXI 6070E because this is beyond the scope of this paper Device uses subsystem Some PXI PCI devices use subsystems for identification purposes Checking this box indicates that your device uses subsystems and that you specify the Subsystem Manufacturer ID and the Subsystem Model Code Subsystem Manufacturer ID If your PXI PCI device uses subsystems you need to specify the Subsystem Manufacturer ID This is a 16 bit value that identifies your PXI PCI device when it is installed The device manufacturer assigns the Subsystem Manufacturer ID Subsystem Model Code If your PXI PCI device uses subsystems you need to specify the Subsystem Model Code This is a 16 bit value that identifies your device when it is installed The device manufacturer assigns the Subsystem Model Code In addition to manually entering all of the basic device and the interrupt information the VISA Driver Development Wizard provides the following two options to automate the process Load settings from Module Description File According to the PXI Specification PXI instruments that use VISA as the low level driver should include a module description file also Known as the module ini file This text file contains the information requested in the Basic
25. r I O you can also query the appropriate attributes for the base and size of each region The functions in LabVIEW and LabWindows CVI for obtaining VISA attributes are introduced shortly 4 1 Step One Initialize the Device The first step in a VISA program is to open a VISA session to the device This task is accomplished using either the viOpen function in a text based programming language or the VISA Open function in LabVIEW Figure 10 shows the diagram of the LabVIEW VI we created to initialize our PXI 6070E li C n ibe esernesinit vi Diagram G af oe a a Irons Rana r ara rs nara nore ror rororo Name Ir Tio ISA a VISA Resource Open F 4 Name Out Peta 1s Ina 8 a Oe Manfld i l Model Code 277199 gt i cag Bi Pe p Compare Value gt Check that we are dealing with g Initialize the PXI BOF0E by writing the a F l 6070E device NED gt ibase address of BART IIOx80 to 041093 National Instruments BARO at offset OxC0 0411560 Pel 6070E Compare Value Figure 10 PXI 6070E Example eserieslnit vi This VI opens a VISA session to a PXI 6070E by calling VISA Open in LabVIEW In the system we displayed previously in MAX the VISA resource name PX12 13 INSTR would be supplied to the Instrument Handle input of VISA Open The corresponding text based function is viOpen Figure 11 shows the LabWindows CVI code to toggle the digital lines of the PXI 6070E via the text based version of the
26. s To demonstrate the use of the VISA API for this purpose this document provides examples using a National Instruments E Series PXI data acquisition module specifically the NI PXI 6070E This data acquisition module is used as a tool to demonstrate the features of NI VISA therefore no register level information about this module is provided beyond the example included The only recommended methods for programming a PXI 6070E are to use the NI DAQm x driver or the NI Measurement Hardware DDK driver development kit In addition to register level communication this document introduces the NI VISA event handling model for handling interrupts from a PXI PCI device Finally it explains how to use LabWindows CVI to install the Windows setup files you create for your device This document introduces the PXI functionality that the NI VISA API provides For a full description of the NI VISA API refer to the N VISA Help which should be installed on your system with the full development version of NI VISA 2 PXI and VISA Background Based on PCI both the CompactPCI and PXI standards define a modular backplane solution packaged in a rugged mainframe topology PXI adopts CompactPCI and extends it by adding features for integrated backplane timing and triggering a slot to slot communication bus a common software structure and more rigid environmental standards all essential for instrumentation systems Because PXI is based on the CompactPCI standard
27. system and return them to your program Because these functions return all VISA resources in your system including GPIB and VXI devices you may narrow down the VISA resources returned by these functions by supplying the viFindRsrc or VISA Find Resource functions with a regular expression that directs it to recover only PXI resources For example we can use the regular expression PXI to tell the VISA driver to return only PXI device resources We may even recover specific devices by supplying a regular expression that includes VISA attributes For example the regular expression PXI http Zone ni com devzone conceptd nsf webra 86256B 5600642A C7 opendocument amp node dz00000_us 90 0 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments VI_ATTR_MANF_ID 4243 tells the VISA driver to return only PXI devices with a manufacturer ID of decimal value 4243 The National Instruments manufacturer ID is hexadecimal 1093 which equals decimal 4243 Because developing the appropriate regular expression to return the specific devices you require can be very complicated there is an easy tool in the VISA Interactive Control you can use to develop the regular expression you need The VISA Interactive Control is installed with VISA and can be found at Start gt gt Programs gt gt National Instruments gt gt VISA Once you have open
28. t once using VISA Map Address but is not set in any of the VISA Poke functions This information is passed from VISA Map Address to VISA Poke 16 The text based example is slightly different because the pointer returned from viMapAddress must be passed to each viPoke16 function Notice the fourth call to VISA Poke 16 in Figure 11 Here we specify the value to be written to the eight digital lines of the PXI 6070E The binary value that we provide to the variable Digital Out Value is written to these lines In the preceding example we have shown only a few of the Low Level Register Access VISA functions See the Register Based Communication section in the NI VISA Help for more information on Low Level Register Access functions 4 3 Step 3 Closing the Device The last step in communication is to close the VISA sessions with our PXI PCI device and the VISA driver Figure 13 shows a VI for closing the VISA session to the PXI 6070E http Zone ni com devzone conceptd nsf weom 6256B 5600642A C7 0pendocument amp node dz00000_us 120 Q 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments ics esenesClose 1 Diagram omejila IS 4 resource name Figure 13 Example eseriesClose vi In LabVIEW to close a session to a VISA resource that you have opened the only function you need to call is VISA Close In the above diagra
29. the VISA Driver Development Wizard you can create a Windows setup INF file as well http Zone ni con devzone conceptd nsf webra 86256B 5600642A C7 opendocument amp node dz00000_us 10 0 142005 5 18 O 10 53 56 Using the VISA Driver Development Wizard and NI VISA to Register L e under Windows T utorial Developer Zone National Instruments as easily set up how NI VISA handles interrupts from your device A detailed knowledge of the register set and register programming of your PXI PCI device is still required but development time is drastically reduced because NI VISA handles the low level Windows programming for you Note Previous versions of NI VISA included the PXI Driver Development Wizard USB support was added to NI VISA 3 0 and the PXI Driver Development Wizard was replaced with the VISA Driver Development Wizard 3 Configuring NI VISA to Recognize a PXI PCI Device Every PXI PCI device must have an associated kernel level driver Windows uses a setup INF file to associate a device and its driver For NI VISA to recognize your device you must use the VISA Driver Development Wizard to create an INF file The VISA Driver Development Wizard is available from the Start menu under National Instruments gt gt VISA Note The following instructions are applicable for the VISA Driver Development Wizard installed with NI VISA 3 1 and above 3 1 Hardware Bus The VISA Driver Development Wizard supports creating INF files for
30. to VISA it is considered a VISA PXI resource A PXI resource is uniquely identified in the system by three characteristics PCI bus number on which it is located PCI device number it is assigned Function number of the device For single function devices the function number is always 0 and is optional for multifunction devices the function number is device specific but is in the range of 0 7 The device number is associated with the PXI or PCI slot number but these numbers usually differ from one PC to another The bus number of a device is consistent from one system boot to the next unless bridge devices are inserted somewhere between the device and the system CPU The VISA resource descriptor you pass to the VISA function viOpen or VISA Open in LabVIEW to access a PCI or PXI device is PXl lt bus gt lt device gt lt function gt INSTR Based on the previous explanation this can be difficult to determine until the device is installed and detected by NI VISA in the system As seen in Figure 8 the PXI device in this example has the resource name PX12 13 INSTR This name indicates that the PXI device is on PXI bus 2 is assigned PXI device number 13 and is a single function device because the function parameter is not explicitly listed You can determine the resource string programmatically by using the NI VISA function viFindRsrc or VISA Find Resource in LabVIEW This function can determine the available NI VISA resources in your
31. torial Developer Zone National Instruments When determining whether your device is asserting a hardware interrupt you can use more than one transaction sequence All comparisons within any given detection transaction sequence must have a result of True for that detection transaction sequence to have a result of True If multiple detection transaction sequences are present the results from every Sequence are compared using a logical OR If any of the sequences have a result of True NI VISA concludes that this interrupt belongs to this device The steps and sequences required to detect if your PXI PCI device is generating an interrupt should be in the register documentation for your device You can add and remove sequences using the Add Sequence and Remove Sequence buttons respectively MI ISA PZI Interrupt Information Type of access Width of access Read Compare T Long 32 bit Address space Offset within space BARO Jaxo00000 A Compare mask Value to write or compare og0000000 Jose0000000 OF Cancel Help Figure 4 Interrupt Information Window In the above example we have specified that to make this determination we must read a 32 bit value from BARO at offset 0x14 This value must then be checked to determine the status of bit 31 highest order bit in the register If bit 31 is high NI VISA knows that our device is generating an interrupt Using the Compare mask we can mask in the particular bits we ne
32. you can use PXI and CompactPCI modules in the same system without conflict Today PXI and CompactPCI are widely used for computer based measurement and automation applications PXI and CompactPCI take full advantage of Microsoft OSs giving you an easy to develop easy to use platform for measurement and automation Because PXI and CompactPCI use PCI as the data communication path PXI and CompactPCI provide the highest performance measurement and automation platform available today More and more of the measurement and automation industry is adopting PXI as a standard platform Until recently the most common way to low level program a PXI device was to use a Windows kernel level driver This process required not only extensive knowledge of the register set of the device but also low level Knowledge of Windows programming This development could be very time consuming because users had to write a separate driver for each Windows OS NI VISA makes this process much easier by acting as the kernel level driver for a device thus eliminating the need for the user to develop a new Windows kernel level driver Using NI VISA also eliminates the need for writing separate device drivers for each Windows OS because NI VISA is already cross platform compatible under Windows 2000 NT XP Me 9x The VISA Driver Development Wizard which is one of the tools available with the full development version of NI VISA even assists you in the Windows setup of your device Through

Download Pdf Manuals

image

Related Search

Related Contents

DemAnDe D`ADHésion  Atterrissage dur et affaissement du train d`atterrissage principal du  Broadmore 1700 - Force10 Networks  Manuel    AEG BBSE 1100  Enobio User manual Neuroelectrics  Silex SX-2000U2    perfectIO NG uidebook - メトラー・トレド - Mettler  

Copyright © All rights reserved.
Failed to retrieve file