09-17-2008 01:43 AM
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.
09-17-2008 05:54 PM
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
09-18-2008 12:21 AM
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.
09-18-2008 10:48 AM
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
09-22-2008 04:40 AM
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
09-22-2008 05:19 PM
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?09-22-2008 10:17 PM
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
09-24-2008 06:08 PM
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
09-25-2008 10:32 PM