Witam. Jestem początkującym w programowaniu, więc proszę o wyrozumiałość. Chcę zrobić sterownik silnika krokowego. Chodzi o pojedyńcze skoki silnika, po naciśnięciu S1, S2. Obsługi silnika na razie nie dopisałem, bo jest to proste i nie potrzebne w tym momencie. Teraz problem (nie wiem jak zmniejszać (przycisk S2), liczbę na LCD. Pewnie głupia rzecz ale coś mi nie wychodzi. Oto mój program:
$regfile = "m8def.dat"
$crystal = 8000000
Config Lcd = 16 * 2
Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0 , E = Portc.4 , Rs = Portc.5
Config Portd.0 = Output 'Led
Config Pinb.0 = Input 'S1 Dodaj
Config Pinb.1 = Input 'S2 Odejmij
Config Pinb.2 = Input 'S3 Zapis do eeprom
Set Portb.0
Set Portb.1 '????????????????????
Set Portb.2
Dim Dodaj As Byte 'Zmienna do odejmij ???????
Dim Odejmij As Byte
Cls
Lcd " Sterownik SIL "
Lowerline
Lcd " By adi84_84 "
Wait 2
Readeeprom Dodaj , 1
Do
Waitms 100
Cls
Lcd " REGULACJA "
Lowerline
Locate 2 , 7
Lcd Dodaj
Lcd "%"
Lcd " "
If Pinb.0 = 0 Then
Waitms 25
If Pinb.0 = 0 Then Portd.0 = 1
Waitms 500
Portd.0 = 0
Incr Dodaj
If Dodaj = 100 Then
Dodaj = 0
End If
End If
'Obsługa S2 ????????????
If Pinb.2 = 0 Then
Waitms 25
If Pinb.2 = 0 Then Writeeeprom Dodaj , 1
Cls
Lcd " ZAPIS DANYCH "
Portd.0 = 1
Wait 2
Portd.0 = 0
End If
Loop
End