Jak zmodyfikowac piniższy program.
żeby poniższy efekt był tez w drugą strone. Na chwile obecna jest tylko biegnące światło w lewo oraz taki mixik. Chciałbym żeby było biegnące światło w lewo, w prawo oraz ten mixik.
Jak sie program umieszcza w zancznikach code??
$regfile = "attiny2313.dat"
$crystal = 8000000 'kwarc 1MHz
$prog &HFC , &HE4 , &H9F , &H00 ' generated. Take care that the chip supports all fuse bytes.
Config Timer1 = Timer , Prescale = 64 'timer1 jako licznik 15536
Config Int0 = Rising 'detetor zera
'"0"-wejście "1"-wyjście
Config Portd = &B1111111
Config Portb = &B00011111
Portd = &B0000000
Portb = &B11100000
Dim Speed As Byte
Dim Speed_memory As Eram Byte At 10
Dim Effect_memory As Eram Byte At 20
Dim Effect As Byte
Dim Move As Byte
Enable Interrupts
Enable Timer1
On Timer1 50ms
Timer1 = 15536
Speed = Speed_memory
Effect = Effect_memory
Do
Debounce Pinb.6 , 0 , Up , Sub
Debounce Pinb.5 , 0 , Down , Sub
Debounce Pinb.7 , 0 , Change_effect , Sub
Loop
Up:
Incr Speed
If Speed > 8 Then Speed = 0
Speed_memory = Speed
Return
Down:
Decr Speed
If Speed > 8 Then Speed = 8
Speed_memory = Speed
Return
Change_effect:
Incr Effect
If Effect > 1 Then Effect = 0
Effect_memory = Effect
Return
50ms:
Select Case Speed:
Case 0 : Timer1 = 3036 '0,5s
Case 1 : Timer1 = 9286 '0,45s
Case 2 : Timer1 = 15536 '0,4s
Case 3 : Timer1 = 21786 '0,35s
Case 4 : Timer1 = 28036 '0,3s
Case 5 : Timer1 = 34286 '0,25s
Case 6 : Timer1 = 40536 '0,2s
Case 7 : Timer1 = 46786 '0,15s
Case 8 : Timer1 = 53036 '0,1s
End Select
If Effect = 0 Then
Select Case Move
Case 0 :
Portd = &B00001 : Portb = &B11100001
Case 1 :
Portd = &B00010 : Portb = &B11100010
Case 2 :
Portd = &B00100 : Portb = &B11100100
Case 3 :
Portd = &B01000 : Portb = &B11101000
Case 4 :
Portd = &B10000 : Portb = &B11110000
Case 5 :
Portd = &B00000 : Portb = &B11100000
End Select
Incr Move
If Move > 5 Then Move = 0
Else
Select Case Move
Case 1 :
Portd = &B10001 : Portb = &B11110001
Case 2 :
Portd = &B01010 : Portb = &B11101010
Case 3 :
Portd = &B00100 : Portb = &B11100100
Case 4 :
Portd = &B01010 : Portb = &B11101010
Case 5 :
Portd = &B10101 : Portb = &B11110101
Case 6 :
Portd = &B00000 : Portb = &B11100000
Case 7 :
Portd = &B10101 : Portb = &B11110101
Case 8 :
Portd = &B00000 : Portb = &B11100000
Case 9 :
Portd = &B11111 : Portb = &B11111111
End Select
Incr Move
If Move > 9 Then Move = 0
End If
Returnżeby poniższy efekt był tez w drugą strone. Na chwile obecna jest tylko biegnące światło w lewo oraz taki mixik. Chciałbym żeby było biegnące światło w lewo, w prawo oraz ten mixik.
If Effect = 0 Then
Select Case Move
Case 0 :
Portd = &B00001 : Portb = &B11100001
Case 1 :
Portd = &B00010 : Portb = &B11100010
Case 2 :
Portd = &B00100 : Portb = &B11100100
Case 3 :
Portd = &B01000 : Portb = &B11101000
Case 4 :
Portd = &B10000 : Portb = &B11110000
Case 5 :
Portd = &B00000 : Portb = &B11100000Jak sie program umieszcza w zancznikach code??