Oh, I see. Sorry about that Chris, with the talk of HPWM and duty-cycle, I thought you were going for the Fader. It helps to know as many details as possible at the beginning.

Originally Posted by
Christopher4187
I was just hoping that there was a 1 line command when you can say "I want to blink the LED every 2 seconds" or something like that.
How's this look?
Code:
<font color="#0000FF"><b><i>; Initialise your Hardware first
</i></b></font><b>LED </b><font color="#008000"><b>VAR </b></font><b>PORTB</b>.<b>2
ONstate </b><font color="#008000"><b>CON </b></font><b>1 </b><font color="#0000FF"><b><i>; 0=ON when LOW, 1=ON when HIGH(default)
</i></b></font><font color="#008000"><b>INCLUDE </b></font><font color="#FF0000">"SingleLEDblinker.bas"
</font><font color="#000080">@ Blink 10, 190 </font><font color="#0000FF"><b><i>; Blink 1/10 sec every 2 seconds
</i></b></font><b>Main</b>:
<font color="#008000"><b>PAUSE </b></font><b>1000
</b><font color="#008000"><b>GOTO </b></font><b>Main</b>
It uses DT_INTS-18 to get interrupts from timer1 every 10 ms, or 100hz.
But you can just change it to DT_INTS-14 if using a 16F.
It simply turns the LED ON, OFF for a number of periods specified by the constants provided.
@ Blink 10, 190
Will turn the LED ON for 10/100th's sec (0.1 sec). and OFF for 190/100th's (1.9 sec). The total of the two, determines the length of time between pulses (2.0 sec) and must be under 65535, which is 655 seconds.
Other included commands are ...
@ NoBlink ONtime, OFFtime
This is the same as Blink, except that it doesn't start Blinking. It simply defines the ON and OFF times in preperation for a ...
@ BlinkON
which can then be placed somewhere else in the program to actually Start the LED blinking.
Of course you need the ...
@ BlinkOFF
To round things out. And now it allows you to make a more custom blinking sequence.
For instance, this one will "FLASH" the LED every second, instead of just Blinking it. Giving more of an "ALERT!" type of indication.
Code:
<font color="#0000FF"><b><i>; Initialise your Hardware first
</i></b></font><b>LED </b><font color="#008000"><b>VAR </b></font><b>PORTB</b>.<b>2
ONstate </b><font color="#008000"><b>CON </b></font><b>1 </b><font color="#0000FF"><b><i>; 0=ON when LOW, 1=ON when HIGH(default)
</i></b></font><font color="#008000"><b>INCLUDE </b></font><font color="#FF0000">"SingleLEDblinker.bas"
</font><font color="#000080">@ NoBlink 3, 3 </font><font color="#0000FF"><b><i>; set Blink to 3/100 ON, 3/100 OFF
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>2000 </b><font color="#0000FF"><b><i>; just to verify it's not blinking
</i></b></font><b>Main</b>:
<font color="#000080">@ BlinkON </font><font color="#0000FF"><b><i>; Start Flashing LED
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>1000 </b><font color="#0000FF"><b><i>; continue for 1 second
</i></b></font><font color="#000080">@ BlinkOFF </font><font color="#0000FF"><b><i>; Stop Flashing LED
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>1000 </b><font color="#0000FF"><b><i>; for another second
</i></b></font><font color="#008000"><b>GOTO </b></font><b>Main
</b>
Or here's several different Blink sequences ...
Code:
<font color="#0000FF"><b><i>; Initialise your Hardware first
</i></b></font><b>LED </b><font color="#008000"><b>VAR </b></font><b>PORTB</b>.<b>2
ONstate </b><font color="#008000"><b>CON </b></font><b>1 </b><font color="#0000FF"><b><i>; 0=ON when LOW, 1=ON when HIGH
</i></b></font><font color="#008000"><b>INCLUDE </b></font><font color="#FF0000">"SingleLEDblinker.bas"
</font><b>Main</b>:
@ <b>Blink 2</b>, <b>10 </b><font color="#0000FF"><b><i>; .02 ON, .1 OFF
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>4000
</b>@ <b>Blink 10</b>, <b>10 </b><font color="#0000FF"><b><i>; .1 ON, .1 OFF
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>4000
</b>@ <b>Blink 20</b>, <b>10 </b><font color="#0000FF"><b><i>; .2 ON, .2 OFF
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>4000
</b>@ <b>Blink 50</b>, <b>50 </b><font color="#0000FF"><b><i>; .5 ON, .5 OFF
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>4000
</b>@ <b>Blink 50</b>, <b>10 </b><font color="#0000FF"><b><i>; .5 ON, .1 OFF
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>5000
</b>@ <b>BlinkOFF </b><font color="#0000FF"><b><i>; stop blinking
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>3000
</b>@ <b>BlinkON </b><font color="#0000FF"><b><i>; resume blinking at same rate
</i></b></font><font color="#008000"><b>PAUSE </b></font><b>5000
</b><font color="#008000"><b>GOTO </b></font><b>Main
</b>
Bookmarks