{{ ************************************ * demo_repeat_blink_led * * 2008 Michael St.Onge * ************************************ Goal: Make an LED blink in a continuous loop Purpose: This will demonstrate the use of the "dira" to set pin to an output state, and then use "outa" to turn on the LED. }} CON _clkmode = xtal1 + pll16x ' Feedback and PLL multiplier _xinfreq = 5_000_000 ' External oscillator = 5 MHz pinLED = 0 ' assign which pin the led is on PUB Blinker ' Main method dira[pinLED]~~ ' Set pin to output (~ sets I/O to input and ~~ sets I/O to output, all pins default to input state) repeat ' Endless loop !outa[pinLED] 'toggles output of pin low/high (if low, then high, or if high, then low) waitcnt(clkfreq / 4 + cnt) ' Wait 1/4 second -> 2 Hz (uses the clock frequency of 5 MHz)