led sequences / macros?

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
Gaz
Posts: 18
Joined: Thu Dec 11, 2008 10:02 am
Contact:

led sequences / macros?

Post 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

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: led sequences / macros?

Post 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.

Post Reply