LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Write two sensors to csv file

Highlighted

Serial write is there becuase sensor has to be interogated with a string of "2" before it will return a temperature

0 Kudos
Message 11 of 20
(408 Views)
Highlighted

I now see that it writes to the file after the stop button is pressed. I need to write to the file itself every 10 seconds. Can you point me in a direction to achieve this? I see in your next post that you say not to move the shift register.

0 Kudos
Message 12 of 20
(408 Views)
Highlighted

To write to the file every 10 seconds is simply a matter of moving the write to file processes that are outside of the while loop into the internal of the case structure, so that when the "Report" case is called the data is written to the file. If you were going to do this i might also suggest having the data flushed to the file or closing the file after every "Report" case as this will help to prevent the loss of large amounts of data if the program fails to close properly.

0 Kudos
Message 13 of 20
(404 Views)
Highlighted

as mentioned previously....also set append to "T". I think its better to write to the file after the vi stops and put an indicator on the "data" shift register array to see the updates....IMHO

append.png

Message 14 of 20
(400 Views)
Highlighted

Ooooh, This is very close to working...

 

Last post from apok is working for a single sensor except for one small issue. There's an extra carriage return being written to the file. Screenshot attached (question about screenshots later). I believe the first CR is coming from from the temp sensor and the extra CR is part of the Write to Spreadsheet File.vi or vice versa. Maybe I can strip the two right most characters off the string from the temp sensor.

 

As for adding the other sensor, I'm going to try adding com4 outside the while loop, placing its respective read/write inside the 'report' case, and change the build array to accomadate another element.

 

I'm new to this posting thing. How do you get a screenshot in line in the post versus adding an attachement?

0 Kudos
Message 15 of 20
(367 Views)
Highlighted

@juliecat wrote:

 

I'm new to this posting thing. How do you get a screenshot in line in the post versus adding an attachement?


download the "JKI VI Package Manager" and click/install "Code Capture Tool" from LAVA...  Smiley Wink

0 Kudos
Message 16 of 20
(340 Views)
Highlighted
Simply click on the Image icon on the toolbar.
0 Kudos
Message 17 of 20
(330 Views)
Highlighted

Julie,

 

Try this solution, as I mentioned, it is a bit advanced, there is a bit of work for you to complete, mainly in the stub VIs that are marked. Also, I have created a simulator to let you test the data logging to make sure that it displays and logs data to your liking. You can change the simulator out for the real serial data by changing the conditional disable structures in the consumer loop. 


Both the Error Logger and Data Logger are background processes that are launched and then hidden, they are both shutdown when the main VI shutsdown through user events. 

 

Give it a try, and let me know. 

 

Thanks,

 

Steven Howell

Certified LabVIEW Developer

Systems Developer

Optimation - Houston

Steven Howell
Certified LabVIEW Developer
Certified Professional Instructor
Systems Developer
Optimation - Houston
steven.howell@optimation.us
0 Kudos
Message 18 of 20
(305 Views)
Highlighted

I have version 2012. Can you save it as that?

0 Kudos
Message 19 of 20
(293 Views)
Highlighted

Sure, try this, sorry about that.

 

Oh, and when you run the simulated data, the dials are going to go nuts, that is normal, I just have three random number generators for the simulator. 

 

 

Steven Howell
Certified LabVIEW Developer
Certified Professional Instructor
Systems Developer
Optimation - Houston
steven.howell@optimation.us
0 Kudos
Message 20 of 20
(288 Views)