09-24-2013 07:45 AM
Hello
I´m trying to get an analog input (volts from a sensor) and a counter from a encoder. I´ve been long looking for a solution and I´ve already found some very helpfull examples that I´ve used on the VI (Thanks for that ;)).
The program is very close to do what I want, but there are still a couple of things that I dont understand (I´m very new with labview and I still don´t know exactly what I´m doing).
-I read in a example here that I should use "Hardware Timed Single Point" and use the "Wait for next Sample Colck VI" to get samples always with a fix period of time (rate). Thats work!. Before, I used "continuos sample" and it was a bit jitter. Well, could someone explain me please what is the difference betwen continuos and Hardware timed, and how the "Harware Timed Single Point" works.
-My second question is about the string formats that I get on the for loop from the waveforms. I´ve tried with very different formats, but it doesn´t work like I expected. I have a string format like this on the "Date Format VI": %S%3u=> seconds with 3 decimals?.
And on the format that I have on the "Array to spreadsheet string VI" I should used %5.7f to get 5 decimals on the output (spreadsheet file). why?.
What I´m trying is to get the analog input sync with the counter (I think I already do), a graph and a file with 3 data rows: 1°-time with 3 decimals, 2°-volts with 5 decimals (negative and positive), and 3°- position (integer negative and positive).
Software: Labview 2013, DAQmx drivers 9.8, Windows 7 32 bits
Hardware: NI PCIe 6321, Intel Quad 9550, 4GB RAM
I hope its undestable, I should learn a bit english to.
Thanks
Solved! Go to Solution.
09-25-2013 08:12 AM
Hey Navarro
1) The difference between continuous and Hardware timed:
sample mode specifies if the task acquires or generates samples continuously or if it acquires or generates a finite number of samples.
Continuous Samples (10123) |
Acquire or generate samples until the DAQmx Stop Task VI runs.(Data are saved in a buffer) |
Finite Samples (10178) |
Acquire or generate a finite number of samples. |
Hardware Timed Single Point (12522) |
Acquire or generate samples continuously using hardware timing without a buffer. Hardware timed single point sample mode is supported only for the sample clock and change detection timing types.
|
and how the "Harware Timed Single Point" works:
Whitepaper: http://www.ni.com/white-paper/3215/en/
for a overview of this topic.Very interesting for a better understanding
3)
1°-time with 3 decimals,here you need a special time-formationcode
2°-volts with 5 decimals (negative and positive), and this is a common numerical-string formationcode
3°- position (integer negative and positive).
Your csv. files looks very well designed with the Formation you expected.
I do not quite understand your problem ?
Yours sincerely,
Simon Hofmann
09-27-2013 02:34 AM
Hello
-Thanks for the answer. I had already read the difference between continuous mode and hardware timed on ni.com but I still don´t know how it works. Where are the data by "Hardware timed" if they are not on a buffer?, how many data can be saved, buffer size?.
-I´ve change a little bit my vi. I solved the problem with the strings format on the "Number to fractional string vi", and I know that my csv was like I wanted. My question was why with a format like %5.7f was not getting a 12345.1234567 float number.?
-Now I have a new problem. I would like that the first measurement (from the card) will start at time=0. I used an example that I found on the forum, but as you can see on my csv, the measurement start some milliseconds after 0. I know that this is the time that the computer needs to process from the "get time/data vi" to the first measurement ("DAQmx Read"). How can I solve it, how can I make that the first measurement start at time = 0?
And my last question. I need to develop a way to save the data more than one time on the program. Should I program a state machine with a shift register with the waveform data?.
Thanks a lot
09-27-2013 07:12 AM
Where are the data by "Hardware timed" if they are not on a buffer?
In hardware-timed single-point sample mode, samples are acquired or generated continuously using hardware timing and no buffer. You must use the sample clock or change detection timing types. No other timing types are supported.
Use hardware-timed single-point sample mode if you need to know if a loop executes in a given amount of time, such as in a control application.
Because there is no buffer if you use hardware-timed single-point sample mode, you should ensure that reads or writes execute fast enough to keep up with hardware timing. If a read or write executes late, it returns a warning.
Continuous Pulses (HW Timed Updates) is hardware-timed single point for counter output. Refer to Hardware-Timed Counter Tasks for more information.
http://zone.ni.com/reference/en-XX/help/370466W-01/mxcncpts/controlappcase4/
My question was why with a format like %5.7f was not getting a 12345.1234567 float number.?
Showon my little example for you: dblToString.vi
How can I solve it, how can I make that the first measurement start at time = 0?
Place the Get date.vi into the sequence
Should I program a state machine with a shift register with the waveform data?.
The best architecture, if you want not use the TDMS streaming, is the Producer / Consumer framework. Plz show in the following attachment:
Cont Acq Producer Consumer to File.vi
best regards,
Simon Hofmann
09-27-2013 07:13 AM
Attachment
10-11-2013 08:31 AM
Hello
Thanks again for the answer. I tried to inplement the code like you say but it was still a error of time. I solve it with a time stamp.
The idea of a producer consumer loop was very good. After "a bit time" I managed to solve that too. Here is the code.
Thanks