Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

question about the digital I/O (priorities of the subVi's)

Hello ppl.

 

I have a question to all of you.  I should write a program for 3 timers in which I can activate any timer whenever I want. When I activate the timer the leds should run one after another and when the time is up the leds should blink simultaneously. I wrote the prog and everything works fine but arises one problem when the timer 1 is up and timer 2 for instance still running. In such a case I see on the digital I/O the leds blink like "simultaneously+one after another" ;kind of superposition :). I want when the time is up in one of the timer the led will blink simultaneously without interfering with the another timer which time is still not ending. I understand this is the case of  high priority or low but I tried to do this and it doesn't help. For each timer I did while loop that have blinking leds subVi (leds blink one after another)  and blinking leds at one time subVi. I tried to do high priority to the blinking_led_at_one time subVi and normal to the blinking leds subVi but the program still working not as expected. I want when one of the timer reaches the case when his time is up will work only the blinking_led_at_one time subVi of him and other blinking leds subVi of other timers will wait.

 

 

Thank you.

0 Kudos
Message 1 of 8
(3,980 Views)

Hello  dimani4,

 

This seems pretty complicated, can you possibly post your VI and sub VI's in a zip folder or else just a screenshot of the code? It'll help to see the order of your events and what's governing them. Also are the LED's just on a board you created?

 

Thank you,

Deborah Y.

Deborah Burke
NI Hardware and Drivers Product Manager
Certified LabVIEW Architect
0 Kudos
Message 2 of 8
(3,958 Views)

Dear Deborah,

 

Here is the prog. The main prog is trytry.vi.  The subVi-blinking leds.vi-the leds blink one after another; subVi-the blinking leds_one time.vi- the leds blink simultaneously. I'm trying to "play" with these subVi's when I spoke about priorities. I set 3 timers each one at different time and timers start to work; leds start to blink one after another but when one of the timers is up the leds should blink simultaneously without interfering of another program that responsible for the blinking leds one after another. Like to give the high priority to the blinking leds_one time.vi and the lowest to the blinking leds.vi.

 

Thank you.

0 Kudos
Message 3 of 8
(3,954 Views)

Hi dimani4,

 

Unfortunately I can't open the .zip file, it says it's invalid, can you please re-zip with all the sub-vi's. Was anyone else looking at this forum been able to open the file?

 

Thank you,

Deborah Y.

Deborah Burke
NI Hardware and Drivers Product Manager
Certified LabVIEW Architect
0 Kudos
Message 4 of 8
(3,931 Views)

Dear Deborah,

 

Rename this file from class8.doc to class8.rar and try to open it.

 

Best Regards,

 

Dima.

0 Kudos
Message 5 of 8
(3,926 Views)

Hello dimani4,

 

I changed it to .rar as instructed and although it launched LabVIEW, the file itself did not open. Was anyone else able to open this? Please post a screenshot or two of the VI, explicitly the LED code areas in question.

 

Thank you!

Deborah Y.

Deborah Burke
NI Hardware and Drivers Product Manager
Certified LabVIEW Architect
0 Kudos
Message 6 of 8
(3,915 Views)

Hi Deborah,

 

Really strange that you can't open this zip file 'cause I opened it in another places without any problems. I can send you all labview files to your mail if you'll give me.

 

Thanks,

 

Dima

 

P.s. I can't post screenshot because it's too big.

0 Kudos
Message 7 of 8
(3,908 Views)

Hello Dima,

 

I was able to open it after downloading the WinRAR tool, thanks for your patience. After opening the main trytry.vi, I see a few things: Since the blinking leds.vi and blinking leds_one time.vi are both signaled to start by the same boolean output (from the 'Less or Equal to 0' node), the order of execution is not forced. Also, I understand you put priorities on your while loops, but when they run in parallel like this, it's tricky and usually unclear as to what is enforcing order on execution to avoid a race condition. I would suggest hard wiring in a wait between these two blink patterns or a different wire to enforce order, like an error wire. A timed structure is another option. Finally, here's a great tutorial with multiple ways to synchronize parallel loops, Using Local Variables, Queues, and Notifiers to Synchronize Data with Parallel Loops.

 

Regards,

Deborah Y.0

Deborah Burke
NI Hardware and Drivers Product Manager
Certified LabVIEW Architect
0 Kudos
Message 8 of 8
(3,890 Views)