'//////////////////////////////////////////////////////// '/// FastAVR Basic Compiler for AVR by MICRODESIGN /// '/// make RC5 interrupt driven instead of pooling /// '/// tested on STK-500 /// '/// RC5int.bas www.FastAVR.com /// '//////////////////////////////////////////////////////// $Device = 8515 $Stack = 32 $Clock = 7.3728 $RC5 = PORTD.2 ' must be on Int0 (or Int1) $Source = On $Def LED= PORTB.7 Declare Interrupt Int0() Dim Adr As Byte, Comm As Byte Dim n As Byte PORTB=&hff ' LEDs on PORTB DDRB=&hff ' so, make it output Int0 Falling Enable Int0 Enable Ovf0 ' for RC5 Enable Interrupts Do ' forever Toggle LED ' WaitMs 100 Loop '/////////////////////////////////////////////////// Interrupt Int0(), Save 2 Disable Int0 ' because of consecutive toggles Enable Interrupts ' because of Ovf0 RC5(Adr, Comm) ' do RC5 receiving If Comm<255 Then ' if received OK PORTB=Not Comm ' show Command on PORTB End If ' Reset Int0 ' reset Int0 flag Enable Int0 ' enable again fo next receive End Interrupt