LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I read in a 1 Hz pwr level file and send it out at 1Hz to the signal generator?

I would like to be able to read in a 1 Hz file and use the format into string and send it out at 1 Hz to a signal generator to vary the levels to match a timestamp. I was trying to use the format into string but I can't figure out how I could read in this file.

00:00.0

-113.586

00:01.0

-113.598

00:02.0

-113.61

00:03.0

-113.622

0 Kudos
Message 1 of 3
(2,433 Views)

If the file is a .csv file as you said in your other post, then you should just be able to use Read From Spreadsheet File, making sure to set the delimiter to comma rather than tab. If it's a small file, you can just read in the whole thing, then use a loop with a Wait For Millisecond Multiple node (the metronome) to send the data once every second.

 

If the file is very large, and you don't want to read it all at once, you can tell the Read From Spreadsheet File node to read only one line at a time. Put the read node and the data sending node in the same While loop, and use a shift register to carry the Mark After Read value from one iteration into the Offset or Mark At Start terminal in the next iteration. That way, you start reading each line at the end of the previous one. Use some form of flow control (such as a Stacked Sequence Structure) to make sure things happen in the right order - read data, wait for the right time, send data. 

Message 2 of 3
(2,410 Views)
What kind of signal generator? If it accepts a waveform data type, you just read the entire file, index out the separate columns, calculate the dt after converting your time strings to timestamp, and then use the Build Waveform function. No need to read line by line and rely on software timed output. The signal generator would use the dt to do a precise, hardware timed output.
0 Kudos
Message 3 of 3
(2,396 Views)