Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How to send data from text file to analog output?

Hi ,
I'nave been trying to solve this problem for couple of hours...and also try to search forum...
I have card 6221, LabView 7.1 and I would like to send samples from long text file to analog output. I don't want to use Express.
Could you please help me?
Thanks,
Radim
 
0 Kudos
Message 1 of 8
(5,021 Views)
I don't quite understand what you are attempting and what your problem is. You are reading one value at a time and doing a bunch of conversions from string to 2D array and then 1D array. Do you really want to write one sample at a time? If so, what is the purpose of the DAQmx Timing function? The samples per channel is incorrect (you are only providing one sample to the DAQmx Write) and the rate does not apply because you are only writing one sample. If you only want to write one sample at a time, it would be much better to read the entire file at once ouside the loop with Read From Spreadsheet File and auto-index the array through the while loop. You would also make the DAQmx Write a single channel>single sample type and not have to do all of the array creation.
0 Kudos
Message 2 of 8
(5,007 Views)
Thank you! It works well with reading one sample and sending to AO.  Is it possible please to read one block of several samples and write it directly to AO, then wait, read again and so on...?
0 Kudos
Message 3 of 8
(4,982 Views)
If you read the entire file at once, you can use the Array subset or if you stick with the file read inside the loop, change the number of bytes to read. Also, you have no mechanism to stop the analog write when you reach the end of the file. With your while loop. when the end is reached, it will just keep writing the last value, I believe.
0 Kudos
Message 4 of 8
(4,977 Views)
Thanks a lot!
0 Kudos
Message 5 of 8
(4,961 Views)

Hey,

 

I think I am having a similar issue.

 

I have an array of values. I want to send them to an analog connection... But I can't send a whole array.. I need to send one value at a time.

 

Could someone give me some direction on this?

 

Im really new at this, as a student.

 

- Justin

0 Kudos
Message 6 of 8
(4,624 Views)

What have you written so far? What language are you using? If it's LabVIEW then all you probably need to do is place a DAQmx Write inside a for loop with the array outside the loop and wired through it and to the DAQmx Write. A for loop will automatically index the array one element at a time. Post the code you've written if you need some help with it.

 

You can find several resources on learning LabVIEW basics here

0 Kudos
Message 7 of 8
(4,608 Views)

Hey,

 

I think I did what your saying. Its working now. 🙂

 

-Justin

0 Kudos
Message 8 of 8
(4,605 Views)