LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Improvement in Program

Hi all,

I have an application in which I have to communicate with two serial port to control two different microcontroller. One of the microcontroller is used to to move a stepper motor while the other one reads a parameter.

Please see the attachment showing front panel of application. Here multiple buttons are given for user for the application. I will just explain main features of the program.

1- When the user presses Auto Scan button Motor goes to start point and moves in defined steps  towards end point, at each step a parameter is read from other controller and is stored in an array. Once motor reaches end position the GUI plots the result doing Gaussian fitting on it.

2- If any of the limit switch is pressed accidentally or manually the motor has to stop immediately.

3-If user presses Motor Stop button motor has to stop immediately and scanning has to be stopped.

In the attached program I have more or less achieved the desired results but I still feel that there are much scope for improvement.

Suggestions are welcome.

Labview user
Download All
0 Kudos
Message 1 of 5
(2,610 Views)

I only looked at the screenshot:

 

Lose the outrageous colors and arrange the buttons and controls so the sequence the user goes through is intuitive, even if that means numbering the controls.

0 Kudos
Message 2 of 5
(2,606 Views)

Don't worry about the colors yet, work on the block diagram.  Look up "state machine".  Both the front panel and the block diagram should fit on one screen (or you should only have to scroll in one direction.)

 

Your diagram is way too big, it has too many sequence structures, too many globals and is very difficult to read.

 

Take a step back and think about the architecture and program flow.

>

"There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal
Message 3 of 5
(2,576 Views)

hi vt92,

I got your point and will try to implement these things in next version.

My main concern was that I have to stop any running loop or subvis whenever user presses Motor Stop button. To achieve this I am reading this button in polled fashion, in a parallel loop and putting the value in a global variable. Now in every Subvi I have a parallel loop which is reading that global variable again in polled fashion and cuasing termination of running loops.

Is there any better way to this.

Labview user
0 Kudos
Message 4 of 5
(2,549 Views)

Use an event structure in a while loop and create a "value change" event for the stop button. The event handler for the Stop button value change would then communicate to all your loops to "stop". There are several methods of inter process communication at your disposal. Since you are "notifying" all your loops to stop, a "Notifier" should work fine. Take a look at the examples using a notifier. It's fairly easy to implement.

0 Kudos
Message 5 of 5
(2,547 Views)