lighting LEDs using PIC 18f4580 in a sequence..

Discussion in 'Embedded Systems and Microcontrollers' started by rizwan_elias, Jun 28, 2011.

  1. rizwan_elias

    Thread Starter New Member

    Dec 11, 2009
    5
    0
    hi guys..
    this is my first post..
    m working on a small project..wat i want to start with is lighting leds, around 30 of them, one after the other..m using PIC 18f4580 with C..i knw this can be done by making one pin HIGH, then LOW..n doing so for all the pins..however, was wondering if ther's a simpler way to do this..appreciate ur assistance..
     
  2. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    This will depend some on which C compiler you use. Have you programmed in C before?
     
  3. rizwan_elias

    Thread Starter New Member

    Dec 11, 2009
    5
    0
    yep..im familiar with C..using C18 from microchip..
     
  4. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Use the shift operator in C. Take look at my pseudo code
    Code ( (Unknown Language)):
    1.  
    2. x=1;
    3. //repeat this as many times as the port(s) have bits  
    4. {
    5. x=x<<1
    6. //data to port
    7. //some delay
    8. }
    9.  
    Google shift operator C for more info
     
  5. rizwan_elias

    Thread Starter New Member

    Dec 11, 2009
    5
    0
    thanks..will look into it..
     
Loading...