Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Streaming inputs to file and to output

Hello,

 

I am trying to sample an analog signal and have the data written to a file and an analog output.  So basically the program looks like this                                                                                                    |  ADC >>> File   |

|           >>> DAC  |

 

All the examples I have found so far only deals with either reading a signal, or writing a signal and not both at the same time.  I managed to create the read portion using DAQmx vis but is at a loss as to how to synchronize the write portion as well, for samples it reads and 1000 samples and writes 1000 samples, then repeats continously.

 

I have also found a strange thing regarding the read portion when I tested it with a 100hz sine wave from a function generator, the signal read was distorted in continous mode.  I tested it with DAQ Assistant just to make sure it was not my read program, it was the same.  I posted this distortion problem already in the LABVIEW thread and recieved one reply, tried that possible solution and it did not work.  Hoping to have better results here.  Attached a picture of the daq assistant setup and the resulting waveform.

 

NI device I am using is the DAQCARD-6062E with connector box block.

 

Thanks

 

 

0 Kudos
Message 1 of 9
(3,464 Views)

Hi Lahan,

 

I'm not seally sure how to interpret the signal you have posted here. There might be something with your connection, but even with reactive load on your source, this signal looks quite weird if it should be sine Smiley Mad

 

If you look for ways how to pass Analog Input to Analog Output, then I would ask what do you need it for?

 

Because, If you acquire samples by AI at specified sample rate and pass those data to output (possibly with some processing), then you can do it just with some reasonable delay between acquisition and generation. Moreover, you need to turn off regeneration mode to assure that each sample will be generated just once. You also need to assure that you have all the time some data in generation buffer, so you can generate  while you are acquiring and making processing. But there has to be some additional logic which handles situation that you will not overflow nor underflow the output buffer over longer period of time. The buffer size, and related delay between signal on input and output will depend on how much processig you need to do between them.

 

If you just need to acquire some signals and generate other, then you just simply create 2 different tasks - AI and AO, and run them separately.

 

 

In some cases what I just described might not be the most appropriate solution, and maybe you would need FPGA. In other application, where you don't need solution, just connect cable from AI (or better said from your signal generator) to place where you need to have the signal, and don't pass it trough AO of DAQ.

 

Therefore I believe that for people on this forum be able to advise you better, would be good idea to give us some more bacground on what you try to accomplish and why.

 

 

Regards,

Stefo

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 2 of 9
(3,410 Views)

Hi stefo,

 

Thanks for replying.

 

My original posting was just to test if I could pass the AI data to AO data with what ever device at hand as I am new to labview.  I have no idea why my sine wave look the way it does during read.  My main goal is to sample 4 AI simultaneously and sum the data for analysis and to send the summed data to 1 AO with as little of a delay as possible between the AI and AO portion.  For the main goal I am hoping to acquire the NI 9234 DAQ with 1 slot ethernet chassis.  From simply playing with the read portion in continous mode, i noticed it has to be in a loop and was stuck at as to how to pass that read data outside the loop to the write/AO task portion.

 

Any input is appreciated.

0 Kudos
Message 3 of 9
(3,404 Views)

Lahan,

 

if you need to do simultaneous sampling, processing and generation with as little delay as possible, you should likely go for FPGA platform. Here we are talking about us delays between AI and AO. I can say that ethernet solution is not the most suitable, because you need to count with bigger delays between AI and AO as you would get with PCI. If you need to have distributed IO, you could go for CompactRIO solution.

 

If you are playing with DAQ platform now, and you struggle how to communicate data between loops, I think the best is to use QUEUE. You should be able to find few examples on how to communicate between multiple loops with queue.

 

regards,

stefo

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 4 of 9
(3,399 Views)

The reason I am going with the NI 9234 with Ethernet is because of the remote nature of the actual sensor and daq, some 200m away from computer, and though I would like to use the compactRIO, available space is the limiting factor here.  As i understand it, compactRIO requires a control unit and chassis to accomdate the daq modules, it simply will not fit in the space I have to work with.

 

It seems I will have to put up with whatever delay is inherent with ethernet. 

 

I will take a look at how queues work.  Will Functional Global work as well?

0 Kudos
Message 5 of 9
(3,396 Views)

Lahan,

 

if form factor is the only concern, then I have to say that cDAQ and cRIO are practically the same size. cRIO needs controller - but it migh be integrated into chassis (in 8 slot chassis). I suggest you to contact your sales representative and speak with him exactly about your application.

 

Queue works like FIFO. You can keep putting data into queue, and when you are reading, you are reading all elements which you wrote and in the same order as they were written. When you want to see examples about queue, open example finder (help -> find examples), and search for queue. I believe that from example called Queue Basics.VI it should be clear.

 

Functional global variables will work with queues, just you need to separate reading and writing. Reading from queue might wait for element even indefinitely long (depends on how it is configured), which could block writer if there were no elements in queue.

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 6 of 9
(3,373 Views)

Hi stefo,

 

I believe currently NI does not have a one slot cRIO chassis similar to the ethernet 1 slot cDAQ and that is the one I am looking to purchase.

 

http://sine.ni.com/nips/cds/view/p/lang/en/nid/205697

 

It is the smallest possible chassis.  I think what you are thinking of is the 8 slotted version of cDAQ and cRIO, which are about the same size.

 

I have solved the distorted sine wave problem though, apparently windows 7 with labview 2010 works, undistorted, while Windows xp pro SP3 with labview 2010 gives distortions. Using basically the same computer, hardware wise.  Strange.

 

 

0 Kudos
Message 7 of 9
(3,368 Views)

Aha. In fact the device you are refering to is not cDAQ, but ENET carrier.

 

i'm glad that it works for you already.

Certified-LabVIEW-Developer_rgb.jpg

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

Sorry for not making the distinction between cdaq modules and cdaq modules with carriers/chassis more clearly.

 

I'll keep that in mind next time.

 

Thanks for your help.

0 Kudos
Message 9 of 9
(3,358 Views)