Witam, proszę o pomoc w rozwiązaniu problemu w tym programie, bo już nie wiem co jest nie tak.
Program ma sprawdzać stan portu pind.2 do którego podłączony jest odbiornik podczerwieni w odstępach 444µs i zapisywać wyniki do eepromu w bajtach.
Zrobiłem to tak:
Program się kończy, ale w eepromie nic nie ma, same jedynki.
Aha, dostaje same jedynki pomimo podawania impulsów z pilota (nie rc5)
Program ma sprawdzać stan portu pind.2 do którego podłączony jest odbiornik podczerwieni w odstępach 444µs i zapisywać wyniki do eepromu w bajtach.
Zrobiłem to tak:
$regfile = "m8def.dat"
$crystal = 16000000
Config Lcd = 16 * 1a ' lub Config Lcd = 16 * 1a
Config Lcdpin = Pin , Db4 = Portc.3 , Db5 = Portc.2 , Db6 = Portc.1 , Db7 = Portc.0 , E = Portc.4 , Rs = Portc.5
Config Pind.2 = Input
Dim Kod As Byte
Dim Numereeprom As Byte
Dim Numerbitu As Byte
Dim Sygnal As Bit
Dim Bufor1 As Byte
Dim Bufor2 As Byte
Dim Bufor3 As Byte
Dim Bufor4 As Byte
Dim Bufor5 As Byte
Dim Bufor6 As Byte
Dim Bufor7 As Byte
Dim Bufor8 As Byte
Dim Bufor9 As Byte
Dim Bufor10 As Byte
Dim Bufor11 As Byte
Dim Bufor12 As Byte
Dim Bufor13 As Byte
Dim Bufor14 As Byte
Dim Bufor15 As Byte
Dim Bufor16 As Byte
Dim Bufor17 As Byte
Dim Bufor18 As Byte
Dim Bufor19 As Byte
Dim Bufor20 As Byte
Dim Bufor21 As Byte
Dim Bufor22 As Byte
Dim Bufor23 As Byte
Dim Bufor24 As Byte
Dim Bufor25 As Byte
Dim Bufor26 As Byte
Dim Bufor27 As Byte
Dim Bufor28 As Byte
Dim Bufor29 As Byte
Dim Bufor30 As Byte
Numereeprom = 0
Cls
Cursor Off
Lcd "czekam na sygn 3"
Wait 1
Cls
Lcd "czekam na sygn 2"
Wait 1
Cls
Lcd "czekam na sygn 1"
Wait 1
Cls
Lcd "GO!"
Config Timer2 = Timer , Prescale = 64
Enable Interrupts
Enable Timer2
Load Timer2 , 111
On Timer2 Odbierz
Do
If Numerbitu = 0 Then Kod.0 = Sygnal
If Numerbitu = 1 Then Kod.1 = Sygnal
If Numerbitu = 2 Then Kod.2 = Sygnal
If Numerbitu = 3 Then Kod.3 = Sygnal
If Numerbitu = 4 Then Kod.4 = Sygnal
If Numerbitu = 5 Then Kod.5 = Sygnal
If Numerbitu = 6 Then Kod.6 = Sygnal
If Numerbitu = 7 Then Kod.7 = Sygnal
Select Case Numereeprom
Case 1 : Bufor1 = Kod
Case 2 : Bufor2 = Kod
Case 3 : Bufor3 = Kod
Case 4 : Bufor4 = Kod
Case 5 : Bufor5 = Kod
Case 6 : Bufor6 = Kod
Case 7 : Bufor7 = Kod
Case 8 : Bufor8 = Kod
Case 9 : Bufor9 = Kod
Case 10 : Bufor10 = Kod
Case 11 : Bufor11 = Kod
Case 12 : Bufor12 = Kod
Case 13 : Bufor13 = Kod
Case 14 : Bufor14 = Kod
Case 15 : Bufor15 = Kod
Case 16 : Bufor16 = Kod
Case 17 : Bufor17 = Kod
Case 18 : Bufor18 = Kod
Case 19 : Bufor19 = Kod
Case 20 : Bufor20 = Kod
Case 21 : Bufor21 = Kod
Case 22 : Bufor22 = Kod
Case 23 : Bufor23 = Kod
Case 24 : Bufor24 = Kod
Case 25 : Bufor25 = Kod
Case 26 : Bufor26 = Kod
Case 27 : Bufor27 = Kod
Case 28 : Bufor28 = Kod
Case 29 : Bufor29 = Kod
Case 30 : Bufor30 = Kod
Case 31 : Goto Koniec
End Select
Loop
End
Odbierz:
Load Timer2 , 111
Sygnal = Pind.2
Incr Numerbitu
If Numerbitu = 8 Then
Numerbitu = 0
End If
If Numerbitu = 7 Then
Incr Numereeprom
End If
Return
Koniec:
Disable Interrupts
Cls
Lcd "zapis do eeprom"
Writeeeprom Bufor1 , 1
Writeeeprom Bufor2 , 2
Writeeeprom Bufor3 , 3
Writeeeprom Bufor4 , 4
Writeeeprom Bufor5 , 5
Writeeeprom Bufor6 , 6
Writeeeprom Bufor7 , 7
Writeeeprom Bufor8 , 8
Writeeeprom Bufor9 , 9
Writeeeprom Bufor10 , 10
Writeeeprom Bufor11 , 11
Writeeeprom Bufor12 , 12
Writeeeprom Bufor13 , 13
Writeeeprom Bufor14 , 14
Writeeeprom Bufor15 , 15
Writeeeprom Bufor16 , 16
Writeeeprom Bufor17 , 17
Writeeeprom Bufor18 , 18
Writeeeprom Bufor19 , 19
Writeeeprom Bufor20 , 20
Writeeeprom Bufor21 , 21
Writeeeprom Bufor22 , 22
Writeeeprom Bufor23 , 23
Writeeeprom Bufor24 , 24
Writeeeprom Bufor25 , 25
Writeeeprom Bufor26 , 26
Writeeeprom Bufor27 , 27
Writeeeprom Bufor28 , 28
Writeeeprom Bufor29 , 29
Writeeeprom Bufor30 , 30
Cls
Lcd "koniec programu"
End 'end program
Program się kończy, ale w eepromie nic nie ma, same jedynki.
Aha, dostaje same jedynki pomimo podawania impulsów z pilota (nie rc5)