LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write two sensors to csv file

Hi,

 

I have data from a temp and a humidity sensor that I'd like to write to a delimited file. Ideally a new line of time stamped data would be written every 10 seconds (haven't attempted the 10 second interval part yet). I'm not sure how to get the temp and humidity out of the two while loops and into a file. The attached vi is what I have so far. Please forgive me if I'm missing something fundamental. I've looked through lots of posts with example code in LabVIEW forum with no luck.

 

Anything specific examples that you can point me to is appreciated.

 

Thanks,

 

Julie

 

 

0 Kudos
Message 1 of 20
(3,013 Views)

you mean that you read temp and humidity sensor at regular intrval of 10 sec. are you using analog card to take samples these sensors via fpga and then save data via RT or on pc.  or they are giving data on serial port.

 

any how as far as my understanding  you can do all this within a single while loop. you can stop the while loop when you receive the data after 10 sec interval. then save the data in a file.

 

if you answer my above mentioned queries then i will amend my vi accordingly. one more thing your vi is not  opening in my LV 8.5 so if you give me the snaphots of your vi then it will be easy for me or save your vi as lv 8.5 

0 Kudos
Message 2 of 20
(3,003 Views)

this might help you, havent tested it..but you will have to modify to your needs Smiley Wink

statemachine w elapsed timer set for 10secs, after timed out goto report out (write, read and insert into array). stop vi and write to file

visa.png

Message 3 of 20
(2,979 Views)

Julie,

 

i am also a new about LV, but i think there should be a while loop out of your program, you can put a timer in this, the time is 10s. the third while loop is redundant i think, you can put the time stamp into the array directly, and then output to spreadsheet. hope there will be usefull.

 

thanks

Ryan

0 Kudos
Message 4 of 20
(2,969 Views)
i am still cannot open your vi as it seems to be saved in higher ver than lv 8.5 can you save it in lv 8.5 ver. moreover you told before that you are using two while loops but there is only one in the picture. can i make it straight considering single sensor data logging after every 10 sec and save it in xml or any report format.because it seems that both sensors are read via serial ports after 10 sec interval.
0 Kudos
Message 5 of 20
(2,952 Views)
i have just made a vi as per my understanding , not tested yet as need to install virtual serial port. however i commented the areas. i hope it will help you solve your problem. sorry because of strange problem i am facing during the attachment i am unable to attach the vi or its snapshot. i browse and aselect the file but when i posted it , only msg text is displayed. i edited it several times but no success
0 Kudos
Message 6 of 20
(2,937 Views)

Hi,

 

Thanks. I like the state machine setup. I modified your example and can see that the 'report' state is firing every 10 seconds, but it is not writing all the way out to the file. Attached screenshot shows two probes placed 1) outside the while loop and 2) outside the case. Probe 2 gets timestamp and temperatures, but probe 1 says Not Executed. Book1.xlsx

 

Julie

 

 

0 Kudos
Message 7 of 20
(2,916 Views)
Of course it's not executed. It will only execute after you press stop and exit the while loop. Basic data flow.
0 Kudos
Message 8 of 20
(2,910 Views)
remove shift register and use indexing for the tunnel (after probe 2) . one more thing why you are using serial write vi before serial read, do you need to send some thing in return of which you get data received?
0 Kudos
Message 9 of 20
(2,907 Views)
Do NOT remove the shift register.
0 Kudos
Message 10 of 20
(2,902 Views)