From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

write data to a logbook file only when a boolean indicator changes

Solved!
Go to solution

Hello

I need to write my local variable state to a simple txt file only when it's true or false state changes.
for example, when my local variable 'temperature too high' is true, I need something like: temperature too high.
When it changes back to false i need: temperature OK. This with a date stamp.
It already worked to get a date stamp and to write the true or false state down but it always gets stuck in a while loop so the program keeps writing the same sentence.

0 Kudos
Message 1 of 6
(3,264 Views)

Post your code so we can do more than guess at what the problem might be.  Smiley Wink

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019 - Unfortunately now moving back to C#, .NET, Python due to forced change to subscription model by NI. 8^{
0 Kudos
Message 2 of 6
(3,262 Views)

I had to take a picture with my phone because we're not allowed to connect the computers with an usb drive, I hope you can see it clear.
I know this while loop causes the program to write the same sentence over and over again but I don't know an other way to do it right.
Thanks 

0 Kudos
Message 3 of 6
(3,255 Views)
Solution
Accepted by topic author Tom_Pa

Hi Tom,

 

pseudocode:

IF current boolean state <> previous boolean state THEN
   save data to file
ENDIF

To check boolean state changes you can use the BooleanCrossing-PtByPt function…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(3,223 Views)

That makes life a little easier. Smiley Wink  I did not know that was there.  I guess I need to get out and look around more.

0 Kudos
Message 5 of 6
(3,208 Views)

0 Kudos
Message 6 of 6
(3,201 Views)