logo elektroda
logo elektroda
X
logo elektroda
REKLAMA
REKLAMA
Adblock/uBlockOrigin/AdGuard mogą powodować znikanie niektórych postów z powodu nowej reguły.

Bascom Attiny2313 dziwne dzialanie programu

barin 07 Cze 2010 10:47 775 2
REKLAMA
  • #1 8164206
    barin
    Poziom 10  
    Witam napisalem programik w Bascom

    Cytat:
    $regfile = "attiny2313.dat"
    $crystal = 4000000

    Config Portb = Input
    Portb = &B11111111
    Config Portd = Output
    Portd.0 = 0
    Portd.1 = 1
    Portd.2 = 0


    Do

    If Pinb.0 = 0 Then

    Portd.0 = 1
    Waitms 50
    Portd.0 = 0
    Waitms 25

    End If

    If Pinb.1 = 0 And Pinb.0 = 0 Then
    Portd.1 = 0
    Waitms 10
    Portd.1 = 1
    Waitms 10

    End If

    If Pinb.1 = 0 Then
    Waitus 100
    Portd.2 = 1

    End If

    If Pinb.2 = 0 Then

    Waitms 10
    Portd.2 = 0

    End If

    Loop

    End



    Nastepnie dodalem do niego:

    Cytat:
    $regfile = "attiny2313.dat"
    $crystal = 4000000

    Config Portb = Input
    Portb = &B11101111

    Config Portd = Output
    Portd.0 = 0
    Portd.1 = 1
    Portd.2 = 0
    Portd.3 = 0
    Portd.4 = 1
    Portd.5 = 0
    Portd.6 = 0
    Do

    If Pinb.0 = 0 Then

    Portd.0 = 1
    Waitms 50
    Portd.0 = 0
    Waitms 25


    End If

    If Pinb.1 = 0 And Pinb.0 = 0 Then
    Portd.1 = 0
    Waitms 10
    Portd.1 = 1
    Waitms 10

    End If

    If Pinb.1 = 0 Then

    Waitus 100
    Portd.2 = 1

    End If

    If Pinb.2 = 0 Then

    Waitms 10
    Portd.2 = 0

    End If

    If Pinb.3 = 1 Then

    Portd.3 = 1
    Wait 1
    Portd.3 = 0

    End If

    If Pinb.6 = 0 And Pinb.7 = 0 Then

    Portd.4 = 1
    Waitms 100
    Portd.5 = 1
    Waitms 200
    Portd.5 = 0
    Portd.1 = 0
    Waitms 100
    Portd.1 = 1
    Wait 1
    Portd.5 = 1
    Waitms 100
    Portd.5 = 0
    Portd.6 = 1
    Waitms 100
    Portd.6 = 0


    End If

    If Pinb.4 = 1 Then
    Wait 1
    Portd.4 = 0

    End If


    Loop


    End


    i mam taki problemik

    If Pinb.0 = 0 Then

    Portd.0 = 1
    Waitms 50
    Portd.0 = 0
    Waitms 25

    to miganie diody w 1 programie miga fajnie a jak dodałem resztę do coś go dusi nie wiem czemu?

    Nazwa tematu łamie chyba wszystkie możliwe punkty regulaminu dotyczące tematu. Proszę poprawić!
    Robak
  • REKLAMA
  • #2 8164226
    guest666
    Poziom 12  
    Prawdopodobnie masz za dużo warunków naraz spełnionych, a że wszystko chodzi w jednej pętli to waitms się sumują i dlatego masz nie równe miganie
  • #3 8164312
    barin
    Poziom 10  
    Nie da się tego jakoś rozwiązać bo działało mi to przez jakiś czas.
    Dziwne strasznie.
REKLAMA