12 led chaser

Discussion in 'Embedded Systems and Microcontrollers' started by jayanath, Jul 16, 2013.

  1. jayanath

    Thread Starter New Member

    Dec 11, 2010
    17
    0
    request provide c code for 12 led chaser of suitable pic with fading effect i mean comet tail effect. thank you
     
  2. blueroomelectronics

    AAC Fanatic!

    Jul 22, 2007
    1,758
    98
    Would you like Fries with that?
     
    absf likes this.
  3. bertus

    Administrator

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

    You just hijacked an old existing thread:
    C Programming blinking LED on PIC16F628A

    That threads belongs to the Topic Starter of that thread.

    Now you have a thread of your own.

    Bertus

    BTW what have you done yourself to make the chaser?
     
  4. 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?


    Code ( (Unknown Language)):
    1.  
    2. #include <pic.h>
    3. #define FADE_RATE 12
    4. #define INITIAL_WIDTH 128
    5. void fade()
    6. {
    7. unsigned char rate = FADE_RATE;
    8. unsigned char pulse_width = INITIAL_WIDTH;
    9. unsigned char count;
    10. while(pulse_width){
    11. PORTB= 0b11111111;
    12. for(count=0; count<pulse_width; count++){
    13. asm("NOP");
    14. }
    15. PORTB=0b00000000;
    16. for(; count; count++){
    17. asm("NOP");
    18. }
    19. if(!rate--){
    20. pulse_width--;
    21. rate = FADE_RATE;
    22. }
    23. }
    24. }
    25. int main(void) {
    26. char b;
    27. TRISB = 0b00000000;
    28. while(1){
    29. for(b=0x02; b; b<<=1){
    30. PORTB = b;
    31. fade(b>>1);
    32. }
    33. for(b=0x40; b; b>>=1){
    34. PORTB = b;
    35. fade(b<<1);
    36. }
    37. }
    38. }
    39.  
     
    Last edited by a moderator: Dec 28, 2013
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Please stop spamming the forum with this code you clearly haven't written yourself (maybe you should ask the author).

    Cluttering the forum with the same code makes us not want to read/respond to all your spam.
     
  6. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Agreed! I just answered in his other thread. There is no need for multiple threads!
     
Loading...