LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

issue with While loop execution time

Solved!
Go to solution

Hello All,

I am working on a labview project but while loop execution time is more than 40ms. Right now i am using student labview version 2013. I dont know why every data is getting saved in txt file after 40ms.

another query is : i am using tab control but instead of data coming in different columns , data is getting saved in a single line.

 

I am attaching my labview files. Please help me out.

 

Thanks

Siddharth

0 Kudos
Message 1 of 11
(3,710 Views)

Hi sidring,

 

but while loop execution time is more than 40ms. … I dont know why every data is getting saved in txt file after 40ms.

Which value did you set as delay? How do you know data is saved "after 40ms"?

(I tested your VI with a delay of 20ms and got 50 lines of data per second as expected…)

 

i am using tab control but instead of data coming in different columns , data is getting saved in a single line.

Because you have programmed it this way!

When you want data in several lines/rows you need to write EOL chars (newline and/or carriage return) too!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(3,693 Views)

The loop iteration is 40 milliseconds.  It is either because you told it to wait that long in your control, or it is actually taking that long to write the data to the file.

 


sidring wrote:3. I dont know why every data is getting saved in txt file after 40ms.

Because you are telling it to write to the file every loop iteration.

 


sidring wrote: i am using tab control but instead of data coming in different columns , data is getting saved in a single line.

You aren't using a tab control in your application, and it would have nothing to do with how the file was saved.

You are using a tab character in your Write to File.  The reason it looks like it is all one line is because you aren't writing a carriage return or line feed character at the end of your data.

0 Kudos
Message 3 of 11
(3,687 Views)

Hi, 

Can you tell me how to do that for data to saved in every column. I mean the solution.

 

Thanks

Siddharth

0 Kudos
Message 4 of 11
(3,681 Views)

Hi GerdW,

 

I am attaching my original work in that i am using arduino and its taking 40 ms time to write in text file.

 

Please check the files.

 

Thanks

Siddharth

Download All
0 Kudos
Message 5 of 11
(3,678 Views)

Hi sidring,

 

well, I guess the Arduino part takes 40ms to execute…

 

When you need an EOL char instead of a TAB char you need to use a different string constant! Simple and easy: check the available constants in the strings palette!

(A TAB char corresponds to the TAB key on your keyboard. When you need to char corresponding to the Return/Enter keys on your keyboard you need to use an EOL char. Basic ASCII stuff…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 11
(3,666 Views)

Here is how to fix the code to add a line feed character.

 

We can't help you with the 40 msec?  Although I set the wait to be a 40 msec default value since all you had was zero.

 

Perhaps it is how long the Arduino takes to respond?  Perhaps it is the file access time?  Are your writing this to a network drive which would generally be a little slower than your hard drive?

0 Kudos
Message 7 of 11
(3,660 Views)

Hi GerdW,

 

Thanks a lot.

 

One more query by using EOL i got the solution as i want in text file but getting error in CSV file.

can you please tell me why am i getting this error.

if you know the solution, then please help me out.

Thanks

Siddharth

 

Download All
0 Kudos
Message 8 of 11
(3,648 Views)

Hi sidring,

 

but getting error in CSV file.

The file is fine. It's the same as your TXT file…

 

can you please tell me why am i getting this error.

CSV is the abbrevation for "comma separated values" - but you are using a TAB char for value separation. Do you see the problem? (Hint: I made some words bold :D)

For me (Europe/Germany) Excel expects a semicolon in CSV files…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 11
(3,639 Views)

That is an Excel problem.   When you call a file, CSV it means comma separated values.  It expects commas between the elements to break them into different cells.  In which case you might be better off using a comma rather than a tab as a separator.

 

If you left it a .txt and opened it in Excel, the import wizard pops up.  You can choose the delimiter.

0 Kudos
Message 10 of 11
(3,635 Views)