Page 1 of 1

led sequences / macros?

Posted: Tue Nov 24, 2009 6:20 pm
by Gaz
Hi all,

I am in the process of building a program that will operate Christmas lights.
I will be using all 8 outputs on port B and was wondering if there is an easier and more compact (code wise) way to write the sequences.
At the moment I am just using simple output / delay /output / delay routines switching one byte on/off at a time.
I would like to put as many different sequences on the chip as possible (16F chips) so would like to keep the code to a minimum to allow this.
Would using macros keep the number of code lines down?

cheers

Gaz

Re: led sequences / macros?

Posted: Wed Dec 02, 2009 2:10 pm
by Benj
Hello

Yes using macros is a good option to save on code size. You could also use a timer interrupt to control the switching on and off of the LEDs. Then simply update the values as part of the main program loop.