Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Programming of 6254 AI pins in VC++

Hi,

      I am using PXI-1045, analog card 6254 to retrive the voltage value. I am new to NI, what i need to know is how to program these AI 0 - AI 32 pins of the 6245 card using Visual C+, that is

1. Intializing  the card.

2. Mapping the analog pins onto my software.

3. Reading voltage values.

 

Please help me with this.

 

Thank you.

 

0 Kudos
Message 1 of 9
(8,035 Views)

Hello,

There are actually quite a few example programs that are included with Measurement Studio for VC++ that are good starting points for doing data acquisition. These are located here:

 

C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\MStudioVC2005\Analog In\Measure Voltage

 

I would recommend starting with AcqVoltageSamples_IntClk example as this is very straight forward and will allow you to easily sample from your channels. This example should perform all three of the functions you listed. 

 

Lars

0 Kudos
Message 2 of 9
(8,022 Views)

Thank you Lar.

Its just that i don't have these examples installed with the NI software, is it possible for you to send me a link to this particular knowledge base?

 

Regards

Sheetal.

0 Kudos
Message 3 of 9
(8,017 Views)

Which version of Visual Studio are you running? Also, which version of Measurement Studio do you have?

 

If you don't have Measurement Studio then your other option would be to use the ANSI C example that are installed with the DAQmx drivers. These are located here: C:\Documents and Settings\All Users\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog In\Measure Voltage.

 

Again, I would recommend starting with the "Acq-Int Clk" example as it does simple voltage acquisition. 

 

Lars

 

 

0 Kudos
Message 4 of 9
(8,003 Views)

Thank you for your reply, it was helpful enough to understand the concept, but it seems like these functions do not support the M series analog board.

Can u suggest with functions supporting M series boards.

 

Regards

 Sheetal

0 Kudos
Message 5 of 9
(7,973 Views)

Hey Sheetal,

Which functions in particular are you having issues with? I've tested this program with a simulated 6254 and it ran with no problems. If the DAQmx drivers are installed then the code should compile and run just fine. Which version of DAQmx do you have?
0 Kudos
Message 6 of 9
(7,963 Views)

Hi Lars,

              Issues i am having with functions like AI_VRead(), i need this function to read the voltage. I have problem in the third variable, i.e, 'channel'  it says expression cannot be evaluated. What i don't know is whether something wrong with the program or i havn't used the right functions to setup or configure the board. Also need to setup or configure the pins of the 6254 analog board,about that i am not really sure which of AI_Configure() , AI_Setup() or SCAN_Setup or  what type of functions to use i am really confused. When the board is tested with MAX software its working fine. Only when i try to programmatically do something it does not work. Can u suggest me what functions and how to call them in Visual C++ 6.0. I am using NI-DAQmx 8.5. I may have asked silly questions thats because NI is new to me, never done this before, hope you understand.

 

Thank you

Sheetal

 

0 Kudos
Message 7 of 9
(7,958 Views)

Hey Sheetal,

I'll certainly try to help.  AI_VRead() is not a valid function that is installed with the DAQmx driver set. Why are you trying to use this function? In the Acq-Int Clk example that I recommended, it uses the DAQmxReadAnalogF64 function. For a comprehensive list of the different functions and their required inputs, you can just refer to the DAQmx C Reference Help located here:

 

Start>>All Programs>>National Instruments>>NI-DAQ>>NI-DAQmx C Reference Help

 

Since it sounds like you are new to Data Aquisition, I would recommend starting with the provided examples.

 

Regards

0 Kudos
Message 8 of 9
(7,938 Views)
Thank you Lars, its working just fine. I am able to read voltage values.
0 Kudos
Message 9 of 9
(7,926 Views)