LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parallel loops run abnormally

Solved!
Go to solution

Hello!

    In my VI, I use parallel loops structure to implement the application. One of loops for controlling four motors, the other for reading data through UART.

    But there is a problem, when implementing the program, sometimes both loops work normally, but sometimes, one of loops is not executed(usually the UART reading loop).

    I want to know why it happen. I upload my program below. The problem VI is quadrotor main(alt hold single PID).vi.  By the way, my LabVIEW version is 2015 and the VI is implemented in NI myRIO controller.

Thank you for your great help.

  

 

0 Kudos
Message 1 of 4
(209 Views)
Solution
Accepted by topic author jackylin888

If the code runs, and gear is set to true by the upper loop, next time you run it, it is still true, and the loop will stop after i=0. If you must use locals for this, reset them.

 

There are other problems, like uninitialized shift registers and the lack of overview. It's OK-ish for now, but if you plan to add more features, you'll need to refactor or get used to solving bugs. 

Message 2 of 4
(191 Views)

Thanks for your rapid reply.

The gear switch is an indicator, and the gear switch is controlled by the RC. So, In my program, if the RC gear switch is on(which means the PWM width is 1900us), the first sequence while loop will stop and implement the second sequence. If RC gear switch is off(which means PWM width is 1100us), the main program will stop. Theoretically, it should be no problem.

 

0 Kudos
Message 3 of 4
(179 Views)

wiebe@CARYA  已寫:

If the code runs, and gear is set to true by the upper loop, next time you run it, it is still true, and the loop will stop after i=0. If you must use locals for this, reset them.

 

There are other problems, like uninitialized shift registers and the lack of overview. It's OK-ish for now, but if you plan to add more features, you'll need to refactor or get used to solving bugs. 


Sorry, I misunderstand your meaning. After resetting the gear switch, it can work properly. 

Thanks for your help.

0 Kudos
Message 4 of 4
(169 Views)