- Код: Выделить всё • Развернуть
$regfile = "Attiny13.dat"
$crystal = 1000000
Config Portb.3 = Output
Config Portb.2 = Output
Config Portb.1 = Output
Config Portb.0 = Output
Config Pinb.4 = Input
Dim Pv As Bit
Dim Vv As Bit
Pv = 0
Vv = 0
Do
If Pv = 0 Then
If Vv = 0 Then
Portb.0 = 0
Portb.1 = 0
Portb.2 = 0
Portb.3 = 0
If Pinb.4 = 0 Then
Pv = 1
End If
End If
End If
If Pv = 1 Then
If Vv = 0 Then
Portb.3 = 0
Waitms 4
Portb.2 = 1
Waitms 4
Portb.1 = 1
Waitms 4
Portb.2 = 0
Waitms 4
Portb.0 = 1
Waitms 4
Portb.1 = 0
Waitms 4
Portb.3 = 1
Waitms 4
Portb.0 = 0
Waitms 4
Portb.2 = 1
Waitms 4
If Pinb.4 = 0 Then
Vv = 1
End If
End If
End If
If Pv = 1 Then
If Vv = 1 Then
Portb.3 = 0
Waitms 4
Portb.2 = 1
Waitms 4
Portb.1 = 1
Waitms 4
Portb.2 = 0
Waitms 4
Portb.0 = 1
Waitms 4
Portb.1 = 0
Waitms 4
Portb.3 = 1
Waitms 4
Portb.0 = 0
Waitms 4
Portb.2 = 1
Waitms 20
If Pinb.4 = 0 Then
Vv = 0
Pv = 0
End If
End If
End If
Loop
P.S. Простите за тафтологию в тексте кода. Принцип такой, при нажатии кнопки переключаются режимы шаговика.