Witam napisałem taki program w bascomie aby rozpocząć zabawę z AVR
połączyłem to w ten sposób:
lecz po włączeniu zasilania na wyświetlaczu pojawiają się tylko kolejno liczby:
3,2,1,0 -tak jak by wszystkie switch'e były wciśnięte na raz.
Po nieudanej próbie napisałem coś takiego :
ten program też nie działa
segment A miga cały czas ,tak jak by switch przy PIND.6 był cały czas wciśnięty.
Już nic nie rozumię
:sm37:
$regfile = "attiny2313.dat"
$crystal = 1000000
Config Portd = Input
Portd = &B0000000
Config Portb = Output
Portb = &B00000000
A Alias Portb.0
B Alias Portb.1
C Alias Portb.2
D Alias Portb.3
E Alias Portb.4
F Alias Portb.5
G Alias Portb.6
Dz Alias Portb.7
Do
Do
If Pind.6 = 1 Then
Portb = &B00000000
Waitms 500
C = 1
D = 1
E = 1
F = 1
G = 1
Waitms 1000
Portb = &B00000000
C = 1
D = 1
G = 1
A = 1
F = 1
Waitms 1000
Portb = &B00000000
D = 1
E = 1
Waitms 1000
Portb = &B00000000
A = 1
B = 1
C = 1
D = 1
E = 1
F = 1
Waitms 1000
Portb = &B00000000
Waitms 500
Dz = 1
Exit Do
End If
Loop
Do
If Pind.0 = 1 Then
Dz = 0
Gosub C1
Exit Do
Elseif Pind.1 = 1 Then
Dz = 0
Gosub C2
Exit Do
Elseif Pind.2 = 1 Then
Dz = 0
Gosub C3
Exit Do
Elseif Pind.3 = 1 Then
Dz = 0
Gosub C4
Exit Do
Elseif Pind.4 = 1 Then
Dz = 0
Gosub C5
Exit Do
Elseif Pind.5 = 1 Then
Dz = 0
Gosub C5
Exit Do
End If
Loop
Loop
C1:
D = 1
E = 1
Return
C2:
C = 1
D = 1
G = 1
A = 1
F = 1
Return
C3:
C = 1
D = 1
E = 1
F = 1
F = 1
Return
C4:
B = 1
G = 1
D = 1
E = 1
Return
C5:
C = 1
B = 1
G = 1
E = 1
F = 1
Return
C6:
C = 1
B = 1
G = 1
E = 1
F = 1
A = 1
Return
Endpołączyłem to w ten sposób:
lecz po włączeniu zasilania na wyświetlaczu pojawiają się tylko kolejno liczby:
3,2,1,0 -tak jak by wszystkie switch'e były wciśnięte na raz.
Po nieudanej próbie napisałem coś takiego :
$regfile = "attiny2313.dat"
$crystal = 1000000
Config Portd = Input
Portd = &B0000000
Config Portb = Output
Portb = &B00000000
Do
if PIND.6=1 Then
toggle PORTB.0
waitms 100
End If
Loop
end
ten program też nie działa
segment A miga cały czas ,tak jak by switch przy PIND.6 był cały czas wciśnięty.
Już nic nie rozumię
:sm37: