A less Cumbersome way of manipulating several LEDS?


Results 1 to 16 of 16

Threaded View

  1. #1
    Join Date
    Mar 2009
    Posts
    653

    Default A less Cumbersome way of manipulating several LEDS?

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

    Code:
    LEDs = %00010011
    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!
    Last edited by HankMcSpank; - 1st September 2011 at 17:03.

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts