LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

first time using daqmx read/write

Well guys, I'm trying to start a task of 8 channels ( In the code I didn't put the channels because my daq isn't connected to PC) read the values, write it on a file and show it as a waveform graph.

 

I created a channel first with DAQmx create channel, after that I used DAQmx timing to put how much samples I need in a second, so I started  a task, read it with DAQmx read and write with DAQmx Wirte. 

 

Is that sequence correct? 

 

Another question is, after I write, how can I show the data in a waveform graph? Because the output of DAQmx write is only the number of samples and the task.

 

Thanks

 

 

 

 

0 Kudos
Message 1 of 18
(4,707 Views)

@EduU wrote:

Well guys, I'm trying to start a task of 8 channels ( In the code I didn't put the channels because my daq isn't connected to PC) read the values, write it on a file and show it as a waveform graph.

 

Is that sequence correct? 

 

Another question is, after I write, how can I show the data in a waveform graph? Because the output of DAQmx write is only the number of samples and the task.

 

Thanks

 

 

 

 


if you are writing to a file...then write to a file Smiley Wink , not the a write daqmx function(that is used for AO purposes). use the file i/o pallette.(write to spreadsheet file)

 

again, to show the data waveform graph...use the file i/o(read from spreadsheet file) to extract the data and use it with the waveform graphing functions.

0 Kudos
Message 2 of 18
(4,701 Views)

Have a look at this example that ships with LabVIEW

C:\Program Files\National Instruments\LabVIEW 2012\examples\DAQmx\Analog Input\Voltage - Continuous Input.vi


CLA CTAChampionI'm attending the GLA Summit!
Subscribe to the Test Automation user group: UK Test Automation Group
0 Kudos
Message 3 of 18
(4,694 Views)

So I have to write to a text file? Or how can I wirte to a I16 file?

 

Because my data is a 2D I16, Can i save it as text and after read it as text and plot in a waveform graph?

 

 

0 Kudos
Message 4 of 18
(4,692 Views)

I don't see why you are putting the date/time string to the channel name.  That is really unnecessary.

 

If you are performing continuous samples, don't limit the buffer size.  That is just asking for trouble.  Leave the Number of Samples on the DAQmx Timing node unwired.

 

If you are doing an Analog Input task, you can't write to it.  DAQmx Write is only used for outputs.

 

After you read that data with the DAQmx Read, you just wire the output to a chart.

 

Don't forget to stop and clear your task.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 18
(4,688 Views)

EduU wrote:

Because my data is a 2D I16, Can i save it as text and after read it as text and plot in a waveform graph?


Why is it a 2D array of I16?  Don't use the raw data.  That just makes things confusing.  And you only have 1 channel.  Use the Single Channel->Multiple Sampes configuration of the DAQmx Read.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 18
(4,684 Views)

Cross, I limit the buffer size because I need do it, I need have only 7200 samples per second, this can get me some problems?

 

I understand your code, but this is only to read and show in a graph, How can I save it in a file, and after when I want to see this file 

I read it again?

 

Write to a TDMS? Text? Binary? Which format is better for my application? Because the data I'm aquiring is I16.

0 Kudos
Message 7 of 18
(4,679 Views)

apok wrote:

again, to show the data waveform graph...use the file i/o to extract the data and use it with the waveform graphing functions.


Why are you telling the OP to write the file and then read it again to graph?  Just use the data straight from the DAQmx Read to graph the data!


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 18
(4,678 Views)

This is only an example so I can understand it and made my own code, in my program I will need 8 channels this is why I have a 2D I16.

I didn't put the channels because my DAQ isn't connected to PC.

0 Kudos
Message 9 of 18
(4,675 Views)

@crossrulz wrote:

Why are you telling the OP to write the file and then read it again to graph?  Just use the data straight from the DAQmx Read to graph the data!



do you want me to list every possible way he can do this? obviously to read a graph,"wire directly to it."....dooooh

 

i assumed to read it at a later time from the file data, i was not going to the assumed obvious

 

note to self: get a crystal ball Smiley Tongue

0 Kudos
Message 10 of 18
(4,669 Views)