From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Register Base Address of E-Series in DAQmx

Need to find the Base Address (BAR1) of an E-Series card using DAQmx.
 
We have a legacy application that uses traditional DAQ and some register level programming (mixed).  We are in the process of migrating to DAQmx and need to rewrite portions of the register level programming code.
In traditional DAQ we use the function
       Get_DAQ_Device_Info (1, ND_BASE_ADDRESS, &bar1);
to find the base address. 
 
What is the equivalent function in DAQmx?
 
I have tried VISA and can find the base address using VISA, but the VISA driver seems to block usage of DAQmx.  Is there a way to use both?
0 Kudos
Message 1 of 10
(4,368 Views)

Hi,

Currently there is no equivalent call in DAQmx to get the base address like the function used in Traditional DAQ.  You were correct in using the VISA functions to get the base address, however it should work with DAQmx and not block usage. Which E-Series board are you using, and which version of LabWindows/CVI do you have?

 

Alex A.

Alex A.
Applications Engineer
0 Kudos
Message 2 of 10
(4,336 Views)

Hi Alex,

I'm using CVI 8.1.1, VISA 4.1 and NI-DAQmx 8.5.0f5 .

When the PCI-6034E is installed without the VISA driver, it appears in MAX explorer under NI-DAQmx devices as "Dev1".  When the VISA driver is installed for the PCI-6034E, the "Dev1" entry still appears but it is shown with a small red x, the icon is greyed out, and it is not possible to run self-test or test panels.  The PCI-6034E then shows up under "PXI System" as PXI::4::2::INSTR.

Based on the red x and greyed out icon, I made the assumption that the DAQmx "Dev1" designation is not available when the VISA driver is installed. 

I have very limited experience with VISA and have always used the "DevX" name assigned by NI-DAQmx for DAQmx function calls, so maybe I'm just missing something basic about using VISA devices in DAQmx function calls.

 

0 Kudos
Message 3 of 10
(4,318 Views)
You should be able to see your device under DAQmx still even with the VISA driver loaded.  You see it under the PXI System because it treats your motherboard as a PXI system and the number corresponds to the slot it is in.  That being said, since it shows up under PXI, it seems to be a configuration error. Try going to your Device Manager in Windows and updating the drivers.  Even though you have the latest drivers, the installation of VISA after the board was loaded with DAQmx could cause a conflict.
Alex A.
Applications Engineer
0 Kudos
Message 4 of 10
(4,313 Views)

The problem persists.

When I boot the computer Device Manager shows the PCI-6034E llisted under "Data Acquisition Devices" and no VISA devices are shown.  MAX shows it as a NI-DAQmx device and a VISA device (presumeably from earlier usage), but my program does not find the VISA device. 

I use the VISA  Driver Wizard to install the VISA driver for the device.  Then it shows in Device Manager as a VISA device and is NOT shown as a National Instruments device.  MAX shows it listed under "NI-VISA PXI Devices" device but shows the listing under "Data Acquisition Devices" ("Dev1") with the red x and the icon greyed out.  My program then finds the VISA device but DAQmx functions report errors "Device not found". 

Perhaps there is something wrong with the VISA driver that I created using the wizard.  This is my first attempt at a VISA driver.  I did not identify any interrupts and may have overlooked other potential requirements. 

Here is a listing of the VISA ini file:

;=============================================================================
;
;  This PXI Module Description File contains information a VISA implementation
;  needs in order to access your PCI-6034E instrument.
;
;=============================================================================

[Module]
ModuleName = "PCI-6034E"
ModuleVendor = "National Instruments"
ModelCode = 0x2CA0
ManufCode = 0x1093
VISARegistration = Simple

 

And here is a listing of the functional portion of the inf file

[Version]
Signature=$WINDOWS NT$
Class=visaPxiDevice
ClassGUID={E1590550-9B9C-11d3-A250-0040055732CC}
Provider=%Vendor0%
DriverVer=08/13/2007,1.0
CatalogFile=PCI6034E.cat

;===========================================================================
;  Default Installer
;===========================================================================

[DefaultInstall]
CopyINF=PCI6034E.inf

[DestinationDirs]

[SourceDisksNames]

[SourceDisksFiles]

;===========================================================================
;  Class Installer
;===========================================================================

[ClassInstall32]
AddReg=AddClass_AddReg

[AddClass_AddReg]
HKR,,,0,%DeviceClassString%
HKR,,Icon,,"-5"

;===========================================================================

[ControlFlags]
ExcludeFromSelect=PCI\VEN_1093&DEV_2CA0&SUBSYS_00000000&REV_00

;===========================================================================


[Manufacturer]
%Vendor1%=PCIList,NTamd64

;===========================================================================
;   PCI Plug and Play Devices
;===========================================================================

[PCIList]
%PCI6034E.DeviceDesc%=PCI6034E_Inst,PCI\VEN_1093&DEV_2CA0
%PCI6034E.DeviceDescN%=PCI6034E_Inst,PCI\VEN_1093&DEV_2CA0&SUBSYS_00000000&REV_00

[PCIList.NTamd64]
%PCI6034E.DeviceDesc%=PCI6034E_Inst,PCI\VEN_1093&DEV_2CA0
%PCI6034E.DeviceDescN%=PCI6034E_Inst,PCI\VEN_1093&DEV_2CA0&SUBSYS_00000000&REV_00

;===========================================================================

[PCI6034E_Inst]
AddReg=PCI6034E_AddReg

[PCI6034E_Inst.Services]
AddService=NiViPciKw, 0x00000002, NiViPciKw_AddService

[PCI6034E_AddReg]
HKR,,DeviceClass,1,72,65,73,75
HKLM,"SOFTWARE\National Instruments\Common\NI-PAL Database\NI-VXI\PCI\10932CA0","HowToSquelch",0,""
HKLM,"SOFTWARE\National Instruments\Common\NI-PAL Database\NI-VXI\PCI\10932CA0","EmergencyDisarm",0,""
HKLM,"SOFTWARE\National Instruments\Common\NI-PAL Database\NI-VXI\PCI\10932CA0","numIsThisMineEntries",0x00010001,0
HKLM,"SOFTWARE\National Instruments\Common\NI-PAL Database\NI-VXI\PCI\10932CA0","ManufName",0,"National Instruments"
HKLM,"SOFTWARE\National Instruments\Common\NI-PAL Database\NI-VXI\PCI\10932CA0","ModelName",0,"PCI-6034E"


;===========================================================================
[NiViPciKw_AddService]
DisplayName   = %NiViPciKw.SvcDesc%
ServiceType   = %SERVICE_KERNEL_DRIVER%
StartType     = %SERVICE_DEMAND_START%
ErrorControl  = %SERVICE_ERROR_NORMAL%
ServiceBinary = %12%\NiViPciKw.sys
;===========================================================================


[Strings]
;  *******Localizable Strings*******

Vendor0="National Instruments"
Vendor1="National Instruments"
PCI6034E.DeviceDesc="PCI-6034E"
PCI6034E.DeviceDescN="PCI-6034E"
DeviceClassString="NI-VISA PXI Devices"
NiViPciKw.SvcDesc="NI-VISA PXI/PCI WDM Driver"

;  *******Non Localizable Strings*******

SERVICE_BOOT_START = 0x0
SERVICE_SYSTEM_START = 0x1
SERVICE_AUTO_START = 0x2
SERVICE_DEMAND_START = 0x3
SERVICE_DISABLED = 0x4

SERVICE_KERNEL_DRIVER = 0x1
SERVICE_ERROR_IGNORE = 0x0
SERVICE_ERROR_NORMAL = 0x1
SERVICE_ERROR_SEVERE = 0x2
SERVICE_ERROR_CRITICAL = 0x3

 

0 Kudos
Message 5 of 10
(4,307 Views)

You'll need to reinstall the card using the Add Hardware wizard of the OS in order for it to work with the DAQmx.  You should not need to use the VISA wizard for it to work in MAX.

 

Alex A. 

Alex A.
Applications Engineer
0 Kudos
Message 6 of 10
(4,266 Views)
Howdy CreviceDweller,
In this case, it sounds like you want DAQmx to be the "driver" for your device, but you want to be able to peek/poke registers behind DAQ's back.  Like Alex mentioned, you need to tell Windows that DAQmx is the driver for your device, not the VISA Wizard generated driver (see the Windows Device Manager).  After you do this, check out the following KnowledgeBase articles:
Setting VISA to Recognize All of the PXI Devices in a PXI System
How Do I Use NI-DAQmx Base with PCI/PXI Devices on Windows?

However, I will not guarantee that VISA will always support this behavior (allowing you to control a PCI/PXI device that is currently "driven" by another NI driver).  Consider that the code that you are writing is brittle and could cause unexpected behavior if authored incorrectly.  Further, I would suggest that you mention your DAQmx feature "needs" to your NI contacts including your sales representative.  Hopefully the DAQmx feature that you request would be delivered prior to VISA dropping support for this capability.
0 Kudos
Message 7 of 10
(4,242 Views)

Hi Jeremiah and Alex,

Thanks much for your help.  With your help I have found a workable solution to my problem.

I expected VISA to be able to find the PCI card using viFindRsrc() and when it failed, I stopped trying VISA assuming something basic was wrong.  Only after using the VISA driver wizard would viFindRsrc() find the PCI card and then DAQmx would not work. 

To solve the problem, I used DAQmxGetDeviceAttribute() to find the DAQmx_Dev_PCI_BusNum and DAQmx_Dev_PCI_DevNum and then constructed the name string "PXI4::2::INSTR" using the returned attributes for the 4 and 2.  Using this instrument description, VISA opens the instrument (with the DAQmx driver installed) and will return the attribute VI_ATTR_PXI_MEM_BASE_BAR1 which I can then use as the address argument to  WriteToPhysicalMemoryEx  and ReadFromPhysicalMemoryEx (adding 2 to bar1base) to communicate with the card registers similar to our legacy code.  I know I could continue to use VISA to access the registers, but this seems to work well.

I am very interested to know if you consider this to be brittle code or if you have suggestions for improving the code.  I would prefer to use a DAQmx call to find the bar1base address and will ask NI to consider adding this attribute to the DAQmxGetDeviceAttribute() function.  Of course I would prefer to not use register level programming at all, but this is not a practical choice in this case. 

Thanks, crevicedweller

0 Kudos
Message 8 of 10
(4,207 Views)
Using the BAR (or some other method) to reliably correlate DAQmx, NI-DAQ, and VISA resources is sorely needed. I have run across several instances of clients/customers attempting to create configuration management tools for their instrument sets and running into this wall of not easily being able to make a programmable 'connection' between driver architectures for their instruments. Kludging around with the configuration tables and stringing together resource names is funky at best, and prone to breakage when there are changes in implementation. This happened at least once to my recollection when NI changed the way resource descriptors were managed - don't recall details, but stuff definitely broke.
 
NI helped write the VISA standard, a little commonality with DAQmx would at least seem logical Robot Sad.  All drivers access the hardware and are fully capable of returning a hard, definable, repeatable piece of data to ID it; BARs would do the trick for PCI/PXI.
 
 
0 Kudos
Message 9 of 10
(4,077 Views)
The DLL we want is this here... nimhwcfu.dll
 
Any chance NI will give us the prototypes? At least just enough to get the BAR programmatically?
Please don't make me take drastic measures; I'd hate to have a near-monopoly on it and have to charge everyone else an arm an a leg. Smiley Wink
0 Kudos
Message 10 of 10
(3,943 Views)