اطلاعیه

Collapse
No announcement yet.

فلاشر با 32 led به وسیله atmega16

Collapse
X
 
  • فیلتر
  • زمان
  • Show
Clear All
new posts

    فلاشر با 32 led به وسیله atmega16

    سلام دوستان

    من یه فلاشر با 32 led به وسیله atmega16 درست کردم می خوام حالت آبشاری روشن و خاموش بشه

    کدش هم اینه:
    کد:
    $regfile = "m16def.dat"
    $crystal = 1000000
    Config Porta = Output
    Config Portb = Output
    Config Portc = Output
    Config Portd = Output
    
    Do
    
    Porta = &B00000001
    Waitms 300
    Porta = &B00000011
    Waitms 300
    Porta = &B00000111
    Waitms 300
    Porta = &B00001111
    Waitms 300
    Porta = &B00011111
    Waitms 300
    Porta = &B00111111
    Waitms 300
    Porta = &B01111111
    Waitms 300
    Porta = &B11111111
    Waitms 300
    
    Portb = &B00000001
    Waitms 300
    Portb = &B00000011
    Waitms 300
    Portb = &B00000111
    Waitms 300
    Portb = &B00001111
    Waitms 300
    Portb = &B00011111
    Waitms 300
    Portb = &B00111111
    Waitms 300
    Portb = &B01111111
    Waitms 300
    Portb = &B11111111
    Waitms 300
    
    Portc = &B00000001
    Waitms 300
    Portc = &B00000011
    Waitms 300
    Portc = &B00000111
    Waitms 300
    Portc = &B00001111
    Waitms 300
    Portc = &B00011111
    Waitms 300
    Portc = &B00111111
    Waitms 300
    Portc = &B01111111
    Waitms 300
    Portc = &B11111111
    Waitms 300
    
    Portd = &B00000001
    Waitms 300
    Portd = &B00000011
    Waitms 300
    Portd = &B00000111
    Waitms 300
    Portd = &B00001111
    Waitms 300
    Portd = &B00011111
    Waitms 300
    Portd = &B00111111
    Waitms 300
    Portd = &B01111111
    Waitms 300
    Portd = &B11111111
    Waitms 300
    
    Loop
    
    End
    می تونید کمک کنید؟

    #2
    پاسخ : فلاشر با 32 led به وسیله atmega16

    در انتهای حلقه، مقدار صفر را در هر چهار پورت بریزید

    دیدگاه


      #3
      پاسخ : فلاشر با 32 led به وسیله atmega16

      می خواستم حالت شهاب سنگی بشه یعنی از اول که شروع می شه تا اخر با هم پیوسته خاموش بشه

      دیدگاه


        #4
        پاسخ : فلاشر با 32 led به وسیله atmega16

        بالاخره چیزی که می خواستم تقریبا شد:
        حالا برم روی مدار ببندمش ببینم چی می شه!!!
        کد:
        $regfile = "m16def.dat"
        $crystal = 1000000
        Config Porta = Output
        Config Portb = Output
        Config Portc = Output
        Config Portd = Output
        
        Do
        
        Porta = &B00000001
        Waitms 20
        Porta = &B00000011
        Waitms 20
        Porta = &B00000111
        Waitms 20
        Porta = &B00001111
        Waitms 20
        Porta = &B00011111
        Waitms 20
        Porta = &B00111111
        Waitms 20
        Porta = &B01111111
        Waitms 20
        Porta = &B11111111
        Waitms 20
        Portb = &B00000001
        Waitms 20
        Porta = &B11111110
        Waitms 20
        Portb = &B00000011
        Waitms 20
        Porta = &B11111100
        Waitms 20
        Portb = &B00000111
        Waitms 20
        Porta = &B11111000
        Waitms 20
        Portb = &B00001111
        Waitms 20
        Porta = &B11110000
        Waitms 20
        Portb = &B00011111
        Waitms 20
        Porta = &B11100000
        Waitms 20
        Portb = &B00111111
        Waitms 20
        Porta = &B11000000
        Waitms 20
        Portb = &B01111111
        Waitms 20
        Porta = &B10000000
        Waitms 20
        Portb = &B11111111
        Waitms 20
        Porta = &B00000000
        Waitms 20
        Portb = &B11111110
        Waitms 20
        Portc = &B00000001
        Waitms 20
        Portb = &B11111100
        Waitms 20
        Portc = &B00000011
        Waitms 20
        Portb = &B11111000
        Waitms 20
        Portc = &B00000111
        Waitms 20
        Portb = &B11110000
        Waitms 20
        Portc = &B00001111
        Waitms 20
        Portb = &B11100000
        Waitms 20
        Portc = &B00011111
        Waitms 20
        Portb = &B11000000
        Waitms 20
        Portc = &B00111111
        Waitms 20
        Portb = &B10000000
        Waitms 20
        Portc = &B01111111
        Waitms 20
        Portb = &B00000000
        Waitms 20
        Portc = &B11111111
        Waitms 20
        Portd = &B00000001
        Waitms 20
        Portc = &B11111110
        Waitms 20
        Portd = &B00000011
        Waitms 20
        Portc = &B11111100
        Waitms 20
        Portd = &B00000111
        Waitms 20
        Portc = &B11111000
        Waitms 20
        Portd = &B00001111
        Waitms 20
        Portc = &B11110000
        Waitms 20
        Portd = &B00011111
        Waitms 20
        Portc = &B11100000
        Waitms 20
        Portd = &B00111111
        Waitms 20
        Portc = &B11000000
        Waitms 20
        Portd = &B01111111
        Waitms 20
        Portc = &B10000000
        Waitms 20
        Portd = &B11111111
        Waitms 20
        Portc = &B00000000
        Waitms 20
        Portd = &B11111110
        Waitms 20
        Portd = &B11111100
        Waitms 20
        Portd = &B11111000
        Waitms 20
        Portd = &B11110000
        Waitms 20
        Portd = &B11100000
        Waitms 20
        Portd = &B11000000
        Waitms 20
        Portd = &B10000000
        Waitms 20
        Portd = &B00000000
        Waitms 20
        
        Loop
        
        End

        دیدگاه

        لطفا صبر کنید...
        X