LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

strange problems about my projects(efficiency,event structure,queue)

hey,Yamaeda

      i can not understand you clearly. does it mean that i shoul put a control in timeout case to end the while loop containg that event structure? i can not figure where it is. in my opinio, once i trigger event structure,then, some case in that structure will happen. at the same time, three loops about controlling queue will suspend. after a particular case in event structure finished, the three loops will execute again. and i do not know your last suggestion, how can i change three loop around event for starters?

0 Kudos
Message 11 of 21
(697 Views)
run your code in highlight mode. Both top loop and an event case can write to visa at the same time, causing problems.
Check Event examples, the most common is to place a while loop around that structure so it can handle several events.
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 12 of 21
(694 Views)

hey,Yamaeda

      in my program, top while loop and event will use uart at the same time. but i think it does not matter, cause top while loop reads data from uart and event writes data to uart. and uart is a kind of full duplex protocal. before this program, i put those three sub loops about queue as an event case, and a top while loop contains this event structure, but once i trigger this case(read data from queue), i can not trigger other events, so i change is to this structure. my aim is to read data continuesly from uart, and at the same time, write some data to uart.

0 Kudos
Message 13 of 21
(692 Views)

Quick suggestion, does this work similar to your idea?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 14 of 21
(688 Views)

hey,

      it works,i can end the program with one control ! thanks for your great patience!!! i am a new bird for labview, so i still want to know the reason behind suggestions that it can end the program with one control press, but my program does not work. however, an old problem still exists, once you press many events, the whole program seems run so slowly. and you can not press other cases

 

0 Kudos
Message 15 of 21
(686 Views)

Your reading loop spins as fast as it can (there's no wait, referring to my 1st assumption on greedy loops) which can cause the write commands to be slow, try a small wait in the read loop (10 or 100ms?) and see if it makes any difference.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 16 of 21
(683 Views)

hey,

      i have put vi(wait) for 100ms in the loop containing visa read. now, the phenomenon is the first two buttons that i press responce quikliy ,then it is hard for me to press more, it shows slow responce

0 Kudos
Message 17 of 21
(681 Views)

It sounds like the event starts taking alot of time, highlight execution mode and/or some timing info is needed to look for that issue, from a code perspective it looks like it should work.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 18 of 21
(679 Views)

hey,

       i highlight the program, it looks like it works except that it is so slow. is there any possible reasons outside the program, like my pc is too old? do you meet the same problem? i add the vi(wait) to the loop containing VISA read in the"suggestions" you give me

0 Kudos
Message 19 of 21
(676 Views)
Add some timig array to find if write or read suddenly takes alot of time
G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
Message 20 of 21
(671 Views)