Hi all,
I seek an easier way of controlling leds!
At the minute, due to my restrictive board layout, I've several leds scattered across all the PIC's port/pins, for example...
Code:
LED0 VAR PortC.6
LED1 VAR PortB.6
LED2 VAR PortB.5
LED3 VAR PortB.4
LED4 VAR PortC.2
LED5 VAR PortC.1
LED6 VAR PortC.0
LED7 VAR PortA.2
LED8 VAR PortA.1
at the minute, to say switch some leds on/off, I'm doing something like this.
Code:
high led0
high led1
low led2
low led3
high led4
...which ok isn't too bad, but gets rather long winded - especially when you want a few different permutations.
Forgive the naive line of questioning, but is there anyway, I can group the 'port diverse' LED mappings all together into something like a virtual Port (or logical byte/word), where I could for example do something like this....
if so, bear in mind I have 9 LEDs ...how would that work out with the above in mind?!
In a similar vein, can I group just two specific leds together for ease of handling? (I always will want two specific LEDS to light/extinguish together - but want to treat them as one entity vs having to duplicate the commands to each port/pin per LED)
Many thanks!
Bookmarks