11-28-2012 01:36 AM
hey,guys,i am a labview user from china,so forgive me about the chinese words of my projest. i found something wrong with my work. .
there are two functions in my "While loop", the first one depends on "queue" and is to get information from UART, the second one is "event structure" to send information through UART. my problems:
1. i can not stop while loop by pressing "停止“, and i find two ways to stop it. first, i press"停止”,then, i press any buttons that can trigger "event structure"twice, at last, while loop can stop.the second way, i press buttons for "event structure" one time, then "停止”, and then the same button for"event". it also works
2.my work does not run efficiently. you guys can try. once you press buttons for "event structure", it responses very slowly,and if you press many times,the whole program seems like suspending.i have added a LED named test at the front panel, it should light once you press "运行“. and it also shows how slow the whole program is.
i have attached my work, and my main vi is "串口通信 主VI".
can any body give me some suggestions? thanks a lot
11-28-2012 02:19 AM - edited 11-28-2012 02:21 AM
from looking at the code firswt thoughts are put a small delay in the while loops say 5ms.(under timing menu, wait(ms).vi) I have not run your code. This delay allows the system to perform tasks in a timely manor and the while loops dont take over, Another problem i have had is that i was taking data from the queue quicker than i was placing data into the queue. This lead to loops etc waiting for data to appear on the queue. May be worth checking
11-28-2012 02:25 AM
11-28-2012 02:28 AM
i think once i press"停止“,the whole while loop should end, why should i also press buttons for "event"?
11-28-2012 02:32 AM
hey,Akiel
i have let my while loop to wait 5ms. but the problem still exists.....from your suggestions, should i check how much data has arrived at queue?
11-28-2012 02:36 AM
to get a queue status look into synchronisation>queue operations>get queue status.vi.
hoipe it helps
11-28-2012 02:38 AM
11-28-2012 02:53 AM
hey,Yamaeda
i make the control button to control the whole loop, and the event has not time out paremeter.this sould be the problem, but if i wire a time value to the "event structure".it can not realise my purpose. in this loop, i want get value countinuely through queue and press button to send something through uart.
11-28-2012 03:06 AM
hey,Yamaeda
after adding time out, i can finish the while loop with control button. but the problem is that after timeout event happens, i can not trigger event, so this approcah can not solve my problem
11-28-2012 04:44 AM