Witam! Mam problem z transmisją RC5. Gdy odpalam układ to na LCD Adres=0 i Komenda=0 gdy natomiast nacisnę jakikolwiek przycisk to Adres=255 a komenda=127. Posiadam układ do odbioru RC5 TSOP31236 połączony wg schematu poniżej.
Atmega jest ustawiona na wewnętrzny kwarc 8Mhz. Próbowałem też zrobić to bez przerwania i efekt był podobny. Gdyby ktoś wiedział co jest nie tak proszę o pomoc. Kod poniżej.
Atmega jest ustawiona na wewnętrzny kwarc 8Mhz. Próbowałem też zrobić to bez przerwania i efekt był podobny. Gdyby ktoś wiedział co jest nie tak proszę o pomoc. Kod poniżej.
$regfile = "m32def.dat"
$crystal = 8000000
Config Porta = Output
Config Portb = Output
Config Portc = Output
Config Portd.0 = Output
Config Portd.1 = Output
Config Pind.2 = Input
Config Portd.4 = Output
Config Portd.5 = Output
Config Portd.6 = Output
Config Portd.7 = Output
Config Lcdpin = Pin , Db4 = Portd.6 , Db5 = Portd.7 , Db6 = Portc.0 , Db7 = Portc.1 , E = Portd.5 , Rs = Portd.4
Config Lcd = 16 * 2
Config Int0 = Low Level
Config Rc5 = Pind.2 , Timer = 0
On Int0 Pobr_rc5
Dim Address As Byte , Command As Byte
Dim Odbr_kodu As Bit
Enable Interrupts
Enable Int0
Set Odbr_kodu
Set Pinb.2
Do
If Odbr_kodu = 1 Then
Cls
Lcd "Adres: " ; Address
Lowerline
Lcd "komenda: " ; Command
Reset Odbr_kodu
Enable Int0
End If
If Address < 255 And Command = 1 Then
Reset Portb.2
Waitms 500
Set Portb.2
End If
Loop
Pobr_rc5:
Disable Int0
Enable Interrupts
Getrc5(address , Command)
Command = Command And &B01111111
Set Odbr_kodu
Return