12 led chaser with pic

Discussion in 'General Electronics Chat' started by jayanath, Dec 2, 2013.

  1. jayanath

    Thread Starter New Member

    Dec 11, 2010
    17
    0
    dear any body please help.i want to make 12 led chaser with fading effect i mean comet tail. followed led to be faded and off. with pic 16f628a help with c code pls
     
  2. adamclark

    Member

    Oct 4, 2013
    472
    6
    Im not sure about the microcontroller but check out Bill_Marsdens blog. You can do that and more with a 555. http://forum.allaboutcircuits.com/blog.php?b=378
     
  3. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Dear jayanath,

    if you have a question, you need to create your own thread. If you want a response within 10 minutes, you need to call someone - this is a forum, not a chat service, people will respond when they get around to it.

    Enjoy the spam after having posted your email account on a public portion of the website.;)

    Edit: the OP was split from another thread. Now I just look like a crazy rambling person with my response...
     
    Last edited: Dec 3, 2013
  4. adamclark

    Member

    Oct 4, 2013
    472
    6
    Why would you want to use a microcontroller and learn code when the lm555 can do it and is very common with tons of schematics and examples? Plus one of the mods here knows the 555 inside and out.. unless of course its for a school project or something where you must use the pic and learn the code.
     
  5. bertus

    Administrator

    Apr 5, 2008
    15,647
    2,346
    Hello,

    You did a hyjack again.
    LED ?
    Please stop hyjacking others threads.

    Bertus
     
  6. jayanath

    Thread Starter New Member

    Dec 11, 2010
    17
    0
    Above thread is older. cannot reply. I have following code. but all leds are fading and getting on together. no running action. how can i make chaser action with fading effect. i mean comet tail. pls help me?



    #include <pic.h>
    #define FADE_RATE 12
    #define INITIAL_WIDTH 128
    void fade()
    {
    unsigned char rate = FADE_RATE;
    unsigned char pulse_width = INITIAL_WIDTH;
    unsigned char count;
    while(pulse_width){
    PORTB= 0b11111111;
    for(count=0; count<pulse_width; count++){
    asm("NOP");
    }
    PORTB=0b00000000;
    for(; count; count++){
    asm("NOP");
    }
    if(!rate--){
    pulse_width--;
    rate = FADE_RATE;
    }
    }
    }
    int main(void) {
    char b;
    TRISB = 0b00000000;
    while(1){
    for(b=0x02; b; b<<=1){
    PORTB = b;
    fade(b>>1);
    }
    for(b=0x40; b; b>>=1){
    PORTB = b;
    fade(b<<1);
    }
    }
    }
     
Loading...