Author Topic: alternating on off leds  (Read 11291 times)

hemiguy

  • Newbie
  • *
  • Posts: 4
  • I'm a llama!
    • View Profile
alternating on off leds
« on: August 08, 2012, 07:59:47 AM »
Hi.
I am using a Nano-10 for led illumination on a vision system. I have a pot on each of the the two two analog inputs to vary the intensity,  then alternately turn on/off the two PWM outputs to create alternate flashing banks of leds. I'm using a .01s clock on each line for timing. Custom functions control the input and output.

Its working ok, but now I want to use a couple of digital inputs to change the timing for high medium low flash rate.
I'm not sure how to go about it.  I could add another line with a different clock rate, but they would all count as it goes through each loop.
My attempts at using timers have not been good. Does anyone have a suggestion?
Thanks,
John


support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re:alternating on off leds
« Reply #1 on: August 08, 2012, 09:28:38 PM »
Since you already have a working program what you can do is to expand on it.

Your external input that is used to select the timing of the clock rate can be used to increment/decrement a variable when the inputs are toggled. The variable will keep track of whether you want to select low, medium or high rate.

An example program for using input to perform such function can be found in your TRiLOGI\TL6\usr\samples folder. The program name is :setTimerCtr_SV.PC6

Once you are able to set the clock selection value, then in your program you simply use the IF THEN ELSE..ENDIF construct to change the time spent turning ON and OFF the lamp based on the value in the clock selection variable.  
Email: support@triplc.com
Tel: 1-877-TRI-PLCS