Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to find out the AI mode using traditional NI driver and VC++ 6.0?

Hello,
the software I manage is written in VC++ 6.0 and utilizes the traditional NI driver. The board used is PCI6013/6014.
The AI mode though may be either differential or nonreferenced single ended. By now we configure the board using Measurement and Automation Explorer, which is OK but is not actually friendly for end users. What I would like to have is at least to be able get the current mode somehow so that the program could warn a user the mode should be changed. Better yet if the program could overwrite the current mode setting so that there would be no need to run Measurement and Automation Explorer at all.
I tried to use AI_Configure function. It looks like it does nothing in this respect - at least for this type of board.
Is there any other way to achieve my goal (direct access to registry settings?)?

Thank you in advance,

Mike Faynberg
0 Kudos
Message 1 of 4
(4,592 Views)
Hi Mike,

Actually you are on the right path.

If you use the AI_Configure command then you can set the input configuration of the DAQ Board.  As seen in the Traditional DAQ C Function Reference Help (Start > National Instruments > NI-DAQ):

AI_Configure

status = AI_Configure (deviceNumber, chan, inputMode, inputRange, polarity, driveAIS)

Purpose

Informs Traditional NI-DAQ (Legacy) of the input mode (single-ended or differential), input range, and input polarity selected for the device. Use this function if you have changed the jumpers affecting the analog input configuration from their factory settings. For devices without analog input configuration jumpers, this function programs the device for the settings you want.

Parameters

Direction Name Type Description
Input deviceNumber i16 assigned by Measurement & Automation Explorer
  chan i16 channel to be configured
  inputMode i16 indicates whether channels are configured for single-ended or differential operation
  inputRange i16 voltage range of the analog input channels
  polarity i16 indicates whether the ADC is configured for unipolar or bipolar operation
  driveAIS i16 indicates whether to drive AISENSE to onboard ground
Simply by setting this parameter in your code you can set the configuration of the board to whatever you would like for your application.  They won't even have to go into MAX to set up the device!

Enjoy,
0 Kudos
Message 2 of 4
(4,582 Views)
Otis,
thank you for your time and effort, but now I am confused. The thing is I have tried this function and it looked it did not work. I intentionally switched to the differential mode using M&A Explorer, and then started my program where AI_Configure was called in order to switch the board back to the single-ended mode. It did not! Both my program complained (I have channels beyond 1 to 8), and the subsequent use A&E Explorer conffirmed the board left in the differential mode. What could cause that?

Thank you in advance,

Mike
0 Kudos
Message 3 of 4
(4,580 Views)
Hi Mike,

Going back to your original theory then, you could use this command and if the error is thrown, based off of the error status code you could then prompt the user to change the settings in MAX. 

Or if you wanted to switch over to DAQmx you could avoid the problem all together because the measurement mode is set in the configuration of the channel.
C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage

Regards,
0 Kudos
Message 4 of 4
(4,575 Views)