Accessing Hardware Registers and Physical Memory in Windows NT/2000/XP with LabVIEW
Primary Software: LabVIEW Development Systems>>LabVIEW Full Development System
Primary Software Version: N/A
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>LabVIEW Professional Development System, LabVIEW Development Systems>>LabVIEW Base Package
Problem: I want to access my hardware directly in Windows NT/2000/XP. How can I communicate directly with hardware I/O registers and physical memory?
Solution:
- Accessing hardware registers in Windows NT/2000/XP using LabVIEW
Hardware registers are accessed using the In Port and Out Port VIs in LabVIEW. See the heading for your version of LabVIEW below for more details:
LabVIEW 8
LabVIEW 8 maintains the functionality available in LabVIEW 7.x, but the In Port and Out Port VIs are now found on the Functions palette at Functions» Connectivity» Port I/O.
LabVIEW 7.x
LabVIEW 7.x ships with In Port and Out Port VIs which work in Windows NT/2000/XP. These are found on the Functions palette at All Functions» Advanced» Port I/O. It is not necessary to install the AccessHW libraries to access hardware registers. The new VIs are polymorphic, allowing you to choose between 8, 16, or 32 bit operations, and are not pin compatible with the VIs from previous versions of LabVIEW. Due to this, minor changes will be necessary when converting applications from LabVIEW 6.1 to LabVIEW 7.x which utilize the In Port and Out Port VIs.
LabVIEW 4.0 - 6.1
The In Port and Out Port VIs that ship with LabVIEW 4.0 through 6.1 do not work on Windows NT/2000/XP because they are not kernel mode routines, which are required for direct hardware access. To work around this, download and install the AccessHW library found at the Port and Memory Utilities for Windows link below. This will install replacement In Port and Out Port VIs which will work in Windows NT/2000/XP. The replacement VIs will be found in the installed directory and can then be used instead of normal In Port and Out Port VIs. If converting existing code, you will need to manually replace each existing In Port and Out Port VI with the newly installed replacements.
- Accessing memory-mapped devices or other locations in physical memory
LabVIEW does not have native support for physical memory access. A library called AccessHW is available which provides this functionality by installing VIs which call LabWindows/CVI functions to allow direct memory access. The AccessHW library can be found at the Port and Memory Utilities for Windows link found below. The AccessHW installation will install the necessary LabWindows/CVI components, and does not require you to own LabWindows/CVI.
Related Links: Developer Zone Example: Port and Memory Utilities for Windows KnowledgeBase 17IE3USR: DAQ Register-Level Programming Resources KnowledgeBase 19LMFHSR: Register Programming a PCI Device and Finding the Correct Address KnowledgeBase 2RCK8PTL: How Can I Write and Read from I/O and Memory Space in CVI?
Attachments:
Report Date: 10/02/2002
Last Updated: 09/25/2007
Document ID: 2Q1FC3K8