LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1: Write to Text File

Solved!
Go to solution

Hello. I am getting an "Error 1 write to text file" in my acquisition program.

 

The error happens occasionaly and I can not figure out what causes the error. What is this error? If I ignore it and press continue the program seems to work and it records the data. The program acquires data, and records to several files. Attached is the screen shot of the error.

 

Thansk for the help

0 Kudos
Message 1 of 9
(7,117 Views)

Hi lav,

 

where exactly do you get this error?

 

Well, it probably originates from a race condition originating in your file-ref locals...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 9
(7,103 Views)

We can't tell very much from what you have posted.

 

Which Write to Text File did the error happen on and what are the values of input parameter when it happens?

Omar
0 Kudos
Message 3 of 9
(7,101 Views)

Hi. Thansk for the quick replys 🙂

 

Attached are some more details: The error happnes in the main acquisition loop in the file-refs (attachment 1). Also the file naming happnes in a seperate while loop (ouside the main acquisition loop). i attached the logic of naming (attachments 2 and 3). 

 

The error happnes only sometimes. The values during the error are just file refs numbers. I wasn't able to figure out the origin of the error and what causes it.

 

Thanks for the help

 

 

Download All
0 Kudos
Message 4 of 9
(7,088 Views)

... when the erro happnes it happens for all file-ref cases (not juts the one i highted).

0 Kudos
Message 5 of 9
(7,082 Views)

It's hard to make sense of your program without seeing it in its entirety.  Please post your VI.

 

It certainly could be a race condition where you are trying to read a local variable of a file reference before you've set it.

Message 6 of 9
(7,074 Views)

Thanks for the reply... I agree that it is most likely the race condition. I put a probe on the name-ref where the error occurs and when there is an error the value is default 0. when there is no error the value is some ref number.

 

How do I go about solving it? I posted the .vi

 

Thanks 🙂

0 Kudos
Message 7 of 9
(7,034 Views)
Solution
Accepted by topic author lav21

I got it. I added an additionl variable to start the recording only after the name-refs have been initilized. it was the race condition problem but now i know more about the labview data flow 🙂

0 Kudos
Message 8 of 9
(6,988 Views)

Hi lav,

 

"I added an additionl variable ... but now i know more about the labview data flow"

That's a contradiction Smiley Wink (Adding even more "variables" has nothing to do with dataflow...)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 9
(6,961 Views)