Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

ADC

We are developing an application which uses NI device called NI USB-6212. We are using this device to convert Analog data (in terms of sine

waves) to Digital output and vice versa.

This application will be developed in C# .Net. To accomplish ADC we are making a wrapper using managed C++ and NIDAQmx.h.


The requirement is as follows:

Generate sine waves
Pass this sine waves to analog channel as Input
Convert these analog signals to digital signal (ADC)
After getting Digital data apply sineFit algorithm.
plot this data on chart  
 

Please note we will NOT be using Measurement Studio for this task.

for this I am creating a Analog Output channel(To pass sine waves to DAQ),
create Analog Input channel to  read analog input channel and on every N sample read from AI i am trying to read digital channle as well.

Please Give me a right approach to ADC using DAQ.
USB-6212 device is used for Analog to digial conversion in my application.

Message 1 of 10
(5,244 Views)

Hello Hari486,

 

To convert Analog data to digital, you need to make a very small logic.

First you need to create Analog Input channel (Single Sample mode), add timing, triggering. Then the single sample data wich you get will be in double precision. So, you need to convert it to U8 Integer and then to Boolean array of 8 Booleans elements. Now as you have digital data of 8 bits, you can apply any algorithm, plot it or take it as output on one Digital Port. The problem may arise while converting double precision number to integer if your Analog input signal is in the range of -1V-1V (for 1V amplitude sine wave). So, you can multiply it by 100 (say), so that it comes in the range of 0-255 (as required for U8 integer).

 

Hope this helps.

0 Kudos
Message 2 of 10
(5,213 Views)

can you please send me the methods available in NIDAQmx.h to convert double value to U8 Integer and then Boolean?

 

Hari

0 Kudos
Message 3 of 10
(5,208 Views)
Define exactly what you mean by 'digital data'. The DAQmx read function will return a floating point number (or array of floats). Do you really need to then convert this to a Boolean array? If you do, conversion functions are not in DAQmx but in your programming language.
0 Kudos
Message 4 of 10
(5,185 Views)

thanks for giving right approach for ADC.

 

The problem may arise while converting double precision number to integer if your Analog input signal is in the range of -1V-1V (for 1V amplitude sine wave). So, you can multiply it by 100 (say),

 

 if you r saying miltiply by 100 this facter is calculated or i can multiply with any value.so that it comes in the range of 0-255 (as required for U8 integer).

 

 

 

0 Kudos
Message 5 of 10
(5,177 Views)

USB-6212 Have capability to convert signal from analog to digital.

 

so to achive ADC

I need to pass sinewaves to DAQ as input and get digital as an output.

 

To achive ADC I am creating AO channel using method (DAQmxCreateAOFuncGenChan)  to generate Sine waves.

and i am trying to read Digial channel using method (DAQmxCreateDIChan) to get digital data.

 

But i am not getting any repaonse on Digital Input channel

 

Is this a correct approch to achive ADC?

 

I have attched my cpp file also

 

Please reply ASAP.

 

 

Message 6 of 10
(5,146 Views)

What you are doing does not make any sense. If you want to capture an analog signal, you would use an analog input and the analog input functions. The digital inputs are for capturing TTL level signals. It sounds like you are at the beginning of your engineering education so TTL signals are logic zeroes and ones that have voltage levels of 0V and 5V. Obviously, a digital input is no good at acquiring a sine wave if you want the capture to look anthing remoetely like a sine wave.

 

Normally, when someone uses a DAQ board to acquire a signal, what is desired is that the software will return a floating point number that corresponds to the voltage that is input to the DAQ board. This is the ADC conversion. For example, if you had a 1V DC signal input, wehn you did a DAQmx analog read, you would get a value of 1.0 back. If you wanted to capture a sine wave, you would instruct the DAQ board to take multiple samples at a certain rate and you would get back an array of floating point numbers that is a numeric representation of that sine wave. The only place you have 'digital', is internally on the DAQ board. You are either very unclear on how a DAQ board and it's driver works or you have not explained what you want very well.

 

p.s. I'm not 100% sure but I don't think the 6212 even supports the FuncGen option. Do you get any error when you call the function? Are you even using any error checking?

Message 7 of 10
(5,139 Views)

thanks for reply

 

yes I don't have much more idea about DAQ How it woks for ADC.

 

 

 

0 Kudos
Message 8 of 10
(5,119 Views)
You might want to refer to the Intrduction to Data Acquisition and the Getting Started with DAQmx though that is mostly targeted to LabVIEW users.
0 Kudos
Message 9 of 10
(5,107 Views)

using device 6212

while generating sine waves using function FuncGen it is giving some exception.

Is there any other approach or API available is NIDAQmx.h.

 

Can I read these sine waves from chennel?

 

please help me.

0 Kudos
Message 10 of 10
(5,025 Views)