In addition, refer to Chapter 3, Software Overview for specific information. To make the code more readable, busacc. Examine the header file for more information on the available macros and constants. You can see these tools in use by reviewing the example programs on memory accesses that appear later in this chapter and also the example programs included with your software.
The purpose of this function is to return various information about the system. GetDevInfo can return the information either a piece at a time, or in one large data structure. The header file devinfo. Refer to the header file for the exact definition of the data structure. The second function destroys this structure and frees the associated memory.
In addition, your program should include a call to CloseVXIlibrary before exiting. An important note about these two functions is that the internal structure maintains a record of the number of calls to.
InitVXIlibrary needs to be called only once, the structure of your program may cause the function to be called multiple times. A successful call to InitVXIlibrary returns either a zero or a one. A zero indicates that the structure has been created, and a one indicates that the structure was created by an earlier call so no action was taken other than incrementing the count of the number of. When CloseVXIlibrary returns a successful code, it also returns either a zero or a one.
A zero indicates that the structure has been successfully destroyed, and a one indicates that there are still outstanding calls to InitVXIlibrary that must be closed before the structure is destroyed. The outcome of all of this is that when exiting a program, you should call CloseVXIlibrary the same number of times that you have called InitVXIlibrary.
Caution: In environments where all applications share NI-VXI, and hence the internal structure such as Microsoft Windows , it can be dangerous for any one application to call CloseVXIlibrary until it returns zero because this can close out the structure from under another application.
It is vital to keep track of the number of times you have called. The System Configuration Functions section of Chapter 3, Software Overview , describes functions that a program can use to access information about the system.
Armed with these functions, a program can be more flexible to changes within the system. This step is omitted only to simplify the example programs. We strongly recommend that you include error checking in your own programs. For example, all VXI devices have at least one logical address by which they can be accessed. However, it is simple to change the logical address of most devices.
Therefore, any program that uses a constant as a logical address of a particular device can fail if that device is reassigned to a different logical address.
You could use the following code to determine the logical address. This information can be returned in either a piecemeal fashion or in one large data structure. Notice that this data structure is a user-defined type, UserLAEntry , which is defined in the devinfo.
This will allow you to use these functions to retrieve information about the devices at run-time. The term is derived from the fact that all commands are 16 bits in length word length , and that strings are sent serially, or one byte at a time. However, the VXIbus specification revision 1. The bit patterns for Word Serial commands have been laid out in the VXIbus specification, and your application can send these commands to a Servant via the WScmd function.
However, because string communication is the most common use for Word Serial Protocol, the functions WSwrt and WSrd use the Word Serial commands Byte Available for sending a byte to a servant and Byte Request for retrieving a byte from a Servant repetitively to send or receive strings as defined by the Word Serial Protocol.
In addition, other common commands such as Clear have been encapsulated in their own functions, such as WSclr. However, there are times when you want the controller to operate as a Word Serial Servant. This chapter also de scribes a different set of functions that a Servant uses for message-based communication with its Commander.
For example, WSSrd Word Serial Servant Read sets up the controller to accept the Byte Request commands from a controller and respond with the string specified in the function. National Instruments strongly recommends that if you want to program the controller as a Servant, you should aim to become familiar with the Word Serial Protocol in detail, and implement as much of the protocol as possible to simplify the debugging and operation of the program.
The main difference between the high-level and low-level access functions is in the amount of encapsulation given by NI-VXI. The high-level VXIbus access functions include functions such as VXIin and VXImove that you can use to access memory in the VXI system without dealing with such details as memory-mapping windows, status checking, and recovering from bus timeouts.
Although these functions tend to have more overhead associated with them than the low-level functions, they are much simpler to use and typically require less debugging. We recommend that beginner programmers in VXI rely on the high-level functions until they are familiar with VXI memory accesses.
Although you now have to perform such actions as bus error handling and mapping—which are handled automatically by the high-level functions—you can experience a performance gain if you optimize for the particular accesses you are performing. Consider the following sample code, which performs a memory access using the low-level functions. Notice that there is no bus error handler installed by the program See the Interrupts and Signals section. This handler automatically increments the BusErrorRecv global variable.
In addition, you can use the functions, rather than the macros, to ensure future compatibility. To force the compiler to use the functions, put the function name in parentheses, for example,.
For this reason, we strongly recommend that you use functions on these platforms to allow your program to be more portable across future platforms. Keep in mind that when the controller shares its resources, it may not allocate them from the local system first. However, the controller may not have prevented the local system from also using this space.
Therefore, it is important that you first use VXImemAlloc to reserve a portion of the shared memory, and then communicate this address to the remote master that will be accessing the slave memory. For example, assume that the following code will run on a controller that has shared 1 MB of local RAM.
In NI-VXI, you can set up your controller to function as both an interrupt handler and an interrupter. You can also have your controller respond to writes to its signal register. In addition, NI-VXI lets you configure both interrupts and signals to be handled either through callback handlers or through the signal queue. See the VXI Signal Functions section in Chapter 3, Software Overview , for more details about the signal queue, but for now you can look upon it as a FIFO first-in, first-out queue that you can access via the signal queue management functions, such as SignalDeq.
See the. Handling either signals or interrupts through the signal queue is very straightforward. You can use the RouteVXIint and RouteSignal functions to specify that the events should be handled by the signal queue. Devices should use only those interrupt lines allocated to them. Again, you can use GetDevInfo to determine what interrupt lines have been allocated to the controller.
Alternatively, you can choose to handle either signals or interrupts with a callback handler. You can use RouteSignal to specify that the events should be handled by the callback handlers rather than the signal queue.
After you have enabled the callback handler through either the. Installing and using callback handlers is very simple with NI-VXI because all of the operating system interaction is handled for you. The following section of code gives an example of using an callback handler. Note: Although NI-VXI simplifies the installation and use of callback handlers, it cannot affect how the system handles interrupts. The programmer must follow programming guidelines set by the chosen operating system.
Some of these guidelines could include using only reentrant functions, adhering to timing restrictions, and on Macintosh computers, regaining access to global variables. To take advantage of this feature, NI-VXI has a wide selection of functions you can use to set up your controller to both source and acknowledge trigger lines.
The VXI system configuration functions copy all of the Resource Manager RM table information into data structures at startup so that you can find device names or logical addresses by specifying certain attributes of the device for identification purposes.
All applications need to use the system configuration functions at one level or another. The InitVXIlibrary function reads the information from resman. From this point on, you can retrieve any device-related information from the entry in the table. In most cases you do not need to modify resource manager information. However, you can use SetDevInfo functions to modify the information in the table.
Your application must call the CloseVXIlibrary function upon exit to free all data structures and disable interrupts. The following paragraphs describe the system configuration functions. The descriptions are presented at a functional level describing the operation of each function.
CloseVXIlibrary is the application termination routine, which must be included at the end or abort of any application. CloseVXIlibrary disables interrupts and frees dynamic memory allocated for the internal RM table and other structures.
You must include a call to CloseVXIlibrary at the termination of your application for whatever reason to free all data structures allocated by InitVXIlibrary and disable interrupts. Failure to call CloseVXIlibrary when terminating your application can cause unpredictable and undesirable results.
If your application can be. It installs default NULL values into the entry. You must use one of the SetDevInfo functions after this point to change any of the device information as needed. You can use any combination of attributes to specify a device.
A -1 negative one or "" specifies to ignore the corresponding field in the attribute comparison. After finding the VXI logical address, you can use one of the GetDevInfo functions to get any information about the specified device. The field parameter specifies the attribute of the information to retrieve. A field value of zero 0 specifies to return a structure containing all possible information about the specified device.
Possible fields include the device name, manufacturer name, and model name. An application must call InitVXIlibrary at application startup. This function configures all hardware interrupt sources but leaves them disabled and installs the corresponding default handlers.
It also creates and initializes any other data structures required internally by the NI-VXI interface. When your application completes or is aborted , it must call CloseVXIlibrary to free data structures and disable all of the interrupt sources.
The field parameter specifies the attribute of the information to change. A field value of zero 0 specifies to change the specified entry with the supplied structure containing all possible information about the specified device.
You should use this function only in very special situations, because it updates information in the NI-VXI interface and can affect execution. No initial changes are necessary for VXI devices. The four basic types of Commander Word Serial transfers are as follows:.
If the Commander is sending a query, it first sends the query in the same manner as sending a command, but then continues by polling the Read Ready RR bit until it is asserted.
The lower 8 bits bits 0 to 7 of the bit command contain a single byte of data bit 8 is the END bit. Therefore, one Byte Available is sent for each data byte in the buffer written. The lower 8 bits bits 0 to 7 of the bit response contain a single byte of data bit 8 is the END bit. Therefore, one Byte Request is sent for each data byte in the buffer read.
In addition to the four basic types of Word Serial transfers, there are two special cases: the Word Serial Clear and Trigger commands. One of the functions of the Clear command is to clear a pending protocol error condition.
The Longword Serial and Extended Longword Serial Protocols are similar to the Word Serial Protocol, but involve bit and bit command transfers, respectively, instead of the bit transfers of the Word Serial Protocol. The VXIbus specification, however, provides no common command usages for these protocols.
The Commander Word Serial functions provide a flexible, easy-to-use interface. Depending upon the hardware and software platforms involved in your system, however, certain issues need to be taken into account. In particular, the behavior of these functions will vary when called from different processes depending on how your operating system performs multitasking.
If portability between operating systems is essential, the Word Serial Protocol functions should not be called from an interrupt service routine. The Commander Word Serial functions require operating system support provided only at the application process level of execution. Calling these functions from the CPU interrupt level will have undetermined results. Welcome to ManualMachine. We have sent a verification link to to complete your registration.
Log In Sign Up. Forgot password? Enter your email address and check your inbox. Please check your email for further instructions. Enter a new password. National Instruments. All Rights Reserved. Warranty The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. Copyright Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation.
Table of Contents Multiple Mainframe Support Table of Contents WSLcmd Table of Contents VXIout Table of Contents Figures Figure A-1 Table A Conventions Used in This Manual The following conventions are used in this manual: bold Bold text denotes parameters, menus, menu items, dialog box buttons or options, or error messages.
This font also emphasizes lines of example code that are different from the other examples. Chapter 1 Overview of NI-VXI Message-Based Devices In addition to register-based devices, the VXIbus specification also defines message-based devices, which are required to have communication registers in addition to configuration registers.
MXIbus Overview The MXIbus is a high-performance communication link that interconnects devices with a cabled communication link for very high-speed communication between physically separate devices. Calling Syntax The interface is the same regardless of the development environment or the operating system used.
Controllers A controller is a device that is capable of controlling other devices. Header Files Although nivxi. Although InitVXIlibrary needs to be called only once, the structure of your program may cause the function to be called multiple times. A zero indicates that the structure has been created, and a one indicates that the structure was created by an earlier call so no action was taken other than incrementing the count of the number of InitVXIlibrary calls.
It is vital to keep track of the number of times you have called InitVXIlibrary. System Configuration Tools The System Configuration Functions section of Chapter 3, Software Overview , describes functions that a program can use to access information about the system.
To force the compiler to use the functions, put the function name in parentheses, for example, VXIpoke addrptr, 2, 0 ; instead of VXIpoke addrptr, 2, 0 ;. After you have enabled the callback handler through either the EnableSignalInt or the EnableVXIint call, the callback function will be invoked when the event occurs. System Configuration Functions The VXI system configuration functions copy all of the Resource Manager RM table information into data structures at startup so that you can find device names or logical addresses by specifying certain attributes of the device for identification purposes.
Programming Considerations The Commander Word Serial functions provide a flexible, easy-to-use interface. Interrupt Service Routine Support If portability between operating systems is essential, the Word Serial Protocol functions should not be called from an interrupt service routine.
You can only view or download manuals with. Sign Up and get 5 for free. Upload your files to the site. You get 1 for each file you add. Get 1 for every time someone downloads your manual.
Buy as many as you need. View and download manuals available only for. Register and get 5 for free. Upload manuals that we do not have and get 1 for each file. Get 1 for every download of your manual. Buy as much as you need. Capabilities of the National Instruments Triggering Hardware Bold text denotes parameters, menus, menu items, dialog box buttons. In Windows, select Start»All. Welcome to ManualMachine. We have sent a verification link to to complete your registration.
Log In Sign Up. Forgot password? Enter your email address and check your inbox. Please check your email for further instructions. Enter a new password. National Instruments. NI USB Introduction The NI USB Series data acquisition devices provide a USB interface for four channels of bit simultaneous sampling analog inputs with integrated signal conditioning. Figure 1. Figure 2. Figure 3. Safety Guidelines for Hazardous Voltages If hazardous voltages are connected to the module, take the following precautions.
Related Documentation Each application software package and driver includes information about writing applications for taking measurements and controlling measurement devices. NET, follow these general steps: 1. NET without Measurement Studio. You need Microsoft Visual Studio. To get to the same help topics from within Visual Studio, go to Help»Contents. You can only view or download manuals with.
Sign Up and get 5 for free. Upload your files to the site. You get 1 for each file you add. Get 1 for every time someone downloads your manual. Buy as many as you need. View and download manuals available only for. Register and get 5 for free. Upload manuals that we do not have and get 1 for each file. Get 1 for every download of your manual.
Buy as much as you need.
0コメント