$crystal = 1000000
$regfile = "attiny2313.dat"
Config Pind.2 = Input
Config Pind.3 = Input
Config Pind.4 = Output
Config Pind.5 = Output
Set Portd.2
Set Portd.3
P1 Alias Pind.2
P2 Alias Pind.3
Led1 Alias Portd.4
Led2 Alias Portd.5
Config Int0 = Low Level
Config Int1 = Low Level
On Int0 Przycisk1
On Int1 Przycisk2
Dim Czas As Byte
Dim I As Byte
Declare Sub Przyciski
czas = 45
Led1 = 0
Led2 = 0
Enable Interrupts
Enable Int0
Enable Int1
Do
For I = 0 To 3
Led1 = 1
Waitms Czas
Led1 = 0
Next I
For I = 0 To 3
Led2 = 1
Waitms Czas
Led2 = 0
Next I
Loop
End
Przycisk1:
disable int0
Waitms 25
If P1 = 0 Then
Incr Czas
End If
enable int0
Return
Przycisk2:
disable int1
Waitms 25
If P2 = 0 Then
Decr Czas
End If
enable int1
Return
Schemat:
Nie bede rysować 2 diód i 2 switchy na to mi szkoda czasu.
Podpinasz diode do pinud.4 i pinud.5 i do masy. Możesz też do plusa, ale wtedy "odwróć" diode.
Switche do pinud.3 i pinud.2, druga nóżka do masy.
Oczywiście nie zapominając o rezysotrach przy diodzie do tego rezystor na reset i kondensator filtrujący 100nF do zasilania.
https://www.elektroda.pl/rtvforum/topic1660552.html