Hi,
I have a problem with detecting rc5 when the atmel is in powerdown mode.
The program should be awake when pressing any rc5 on the remote and do a reset when i press only 1 specific key.
It never execute the part marked as 'test2'.
anyone have a good sugestion. ?
'----------------------------------------------------------------------------------------------------------------------------
$prog &HFF , &HEE , &HD9 , &HFF ' generated. Take care that the chip supports all fuse bytes.
$regfile = "m128def.dat" ' specify the used micro
Config Submode = New
$crystal = 8000000 ' used crystal frequency
$baud = 4800 ' use baud rate
$hwstack = 200 ' default use 32 for the hardware stack
$swstack = 200 ' default use 10 for the SW stack
$framesize = 200 ' default use 40 for the frame space
Dim Rc5_adres As Byte
Dim Rc5_commando As Byte
Dim Ir_vlag As Bit
Config Rc5 = Pine.6 , Wait = 1000
Enable Int6
Config Int6 = Low Level
On Int6 Int6_isr
Enable Interrupts
'Lcd
Config Lcdpin = Pin , Db4 = Porta.3 , Db5 = Porta.2 , Db6 = Porta.1 , Db7 = Porta.0 , E = Porta.4 , Rs = Porta.6
Config Lcd = 16 * 3 , Chipset = Dogm163v5
Cls
Cursor Off Noblink
Locate 2 , 1 : Lcd " P o w e r o f f"
Config Powermode = Powerdown
'------------------------------------- M A I M ---------------------------------------------------------------------------
Do
' test 1
If Ir_vlag = 1 Then
Cls
Cursor Off Noblink
Locate 2 , 1 : Lcd " P o w e r = o n"
End If
' test 2
If Ir_vlag = 1 Then
Getrc5(rc5_adres , Rc5_commando)
Rc5_commando = Rc5_commando And &B01111111 ' clear toggle bit
If Rc5_adres = &H00 Then
Select Case Rc5_commando
Case 40
Goto _reset
End Select
End If
End If
Loop
'--------------------------------------------------------------------------------------------------------
Int6_isr:
Ir_vlag = 1
Return
'--------------------------------------------------------------------------------------------------------
End
[b:807da04f6c][color=red:807da04f6c](BASCOM-AVR version : 2.0.7.6 )[/b:807da04f6c][/color:807da04f6c]
↧