LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LED blinking in while loop

Hello

My application involves reading data off of a serial port at 26Hz.  I am parsing this data in real time and writing statistics to file.  I want to have an LED blink each time a file is written (I have a files being written in the following intervals: 1sec, 3sec, 15sec, 60sec, 10min).  My problem is that the LED only stays illuminated for the single iteration, which is dictated by the speed I am reading from the serial port.  Is there a clever way to have the LED flash for a standard .5 sec without creating timing issues?

Cheers!
0 Kudos
Message 1 of 18
(9,270 Views)
In order to make an LED "blink" you can create a property node and select blinking.
 
Do you have the files written only 5 times at 1sec, 3sec, 15sec, 60sec, 10min, resulting in 5 files.  Or do you have files written every 1sec, 3sec, 15sec, 60sec, 10min?
0 Kudos
Message 2 of 18
(9,264 Views)
Thank you for the reply,  I create a new set of five files at midnight and append to them throughout the day at the given interval.  As I understand it the property node causes the LED to blink at a set interval.  I am looking to have the LED blink at the predetermined interval (1sec, 3sec, 15sec...) and stay illuminated for 0.5sec each time it blinks.  I have the triggering for the blinking worked out so that it blinks when I want it to, the problem is that it is in a while loop that is executing very quickly and so the LED doesnt stay illuminated for very long when it does blink.  I hope that this helps.

Cheers!
0 Kudos
Message 3 of 18
(9,260 Views)
Do you have other activity inside of this while loop?  If not you can just put a Wait command that will keep the LED illuminated until the wait is over and the loop moves on to the next iteration.
 
Attaching your code will help as well Smiley Wink

Message Edited by Steve.Briggs on 10-30-2007 11:33 AM

0 Kudos
Message 4 of 18
(9,257 Views)
The while loop is primarly used to to read the serial port and write the data to file.  The problem with using a wait millisecond command is that it will throw off the reading from the serial port, the most I can wait is 38 milliseconds otherwise I will miss data at the port.  I will see about getting my code up, unfortunately I will be out of the office for most of today.  Thank you very much for the help!

Cheers!
0 Kudos
Message 5 of 18
(9,249 Views)
Somehow incorporating the wait with the timing intervals for your read could do the trick.  For instance, you read at intervals no less than 1 second, so instead read at an interval of 0.5 second, and have the wait for 0.5 seconds.  You'll get both the 0.5 second illumination of the LED and a read that performs 0.5 seconds after, giving you 1 second.  Same thing goes for the other intervals you wish to read at.
0 Kudos
Message 6 of 18
(9,222 Views)
Perhaps a simple timer would work. Either the Elapsed Time vi or the Get Date/Time in Seconds. Use a boolean that gets set at the time you read the data, and resets the timer. After the 0.5 seconds of elapsed time, change the indicator. That shouldn't use a while loop or any delay, so it shouldn't affect your reading or writing of the data. I just posted a simple example here: http://forums.ni.com/ni/board/message?board.id=170&message.id=281242&jump=true#M281242

Hope it helps.

B-)
Message 7 of 18
(9,202 Views)

hi,

 

I am looking for a similar solution to my problem and hope some smart guy here could help me for this. I am reading sync pulses from a laser (1 to 20 Hz) through one of the input counters of my DAQ PCI 6221.I am able to read the number of pulses at input counter however, I would like to let a LED blink on each edge detected at input counter. In other words, I would like a boolean output for each detected pulse. 

 

thanks

immi

0 Kudos
Message 8 of 18
(8,711 Views)

Hi immi,

 

Check out this vi. This Vi make the Led blink, when it detects a Rising/Falling Edge in the signal.

 

 

Rgds,

Venky

0 Kudos
Message 9 of 18
(8,709 Views)

Hi Venky,

 

Thanks for prompt reply. Sorry I forgot to mention that I am using Labview V8.0 and the Vi is not opening with it.

 

 

regards

immi

0 Kudos
Message 10 of 18
(8,704 Views)