取消
显示结果 
搜索替代 
您的意思是: 

issue with While loop execution time

已解决!
转到解答

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 项奖励
1 条消息(共 11 条)
4,404 次查看

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 项奖励
2 条消息(共 11 条)
4,387 次查看

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 项奖励
3 条消息(共 11 条)
4,381 次查看

Hi, 

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

 

Thanks

Siddharth

0 项奖励
4 条消息(共 11 条)
4,375 次查看

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

下载全部
0 项奖励
5 条消息(共 11 条)
4,372 次查看

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 项奖励
6 条消息(共 11 条)
4,360 次查看

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 项奖励
7 条消息(共 11 条)
4,354 次查看

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

 

0 项奖励
8 条消息(共 11 条)
4,342 次查看

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 项奖励
9 条消息(共 11 条)
4,333 次查看

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 项奖励
10 条消息(共 11 条)
4,329 次查看