{{ ************************************ * demo_repeat_blink_led_group * * 2008 Michael St.Onge * ************************************ Goal: Make a group of LED's simultaneously 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 group of LED's. }} CON _clkmode = xtal1 + pll16x ' Feedback and PLL multiplier _xinfreq = 5_000_000 ' External oscillator = 5 MHz pinLEDstart = 0 ' assign which pin the first led in the group is on pinLEDend = 2 ' assign which pin the last led in the group is on ' (you can have as many LED's in your group as your group as you want as long as you don't exceed the maximum current of 30 mA.) PUB Blinker ' Main method dira[pinLEDstart..pinLEDend]~~ ' 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[pinLEDstart..pinLEDend] 'toggles output of the group of pins 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)