Bei Mega64 u. 128
Code:
$regfile = "m64def.dat"
$crystal = 16000000
$baud = 9600
Config Int2 = Falling
Config Int2 = Rising
Config Int2 = Low Level
Enable Int2
Do
Loop
;----------------------------------------------
; Config Int2 = Falling
;----------------------------------------------
LDS r24,EICRA
ANDI r24,0xCF ; clear ISC20 + ISC21
;-------------------- !!!!!!!!!!!!!
ORI r24,0x10 ; set ISC20
;-------------------- !!!!!!!!!!!!!
STS EICRA,r24
;----------------------------------------------
; Config Int2 = Rising
;----------------------------------------------
LDS r24,EICRA
ANDI r24,0xCF ; clear ISC20 + ISC21
;-------------------- !!!!!!!!!!!!!
ORI r24,0x18 ; set ISC20 + ISC11
;-------------------- !!!!!!!!!!!!!
STS EICRA,r24
;----------------------------------------------
; Config Int2 = Low Level
;----------------------------------------------
LDS r24,EICRA
ANDI r24,0xCF ; clear ISC20 + ISC21
ORI r24,0x00 ; none
STS EICRA,r24
;----------------------------------------------
; Enable Int2
;----------------------------------------------
IN r24,EIMSK
ORI r24,0x04
OUT EIMSK,r24
;----------------------------------------------
Do
Loop
;----------------------------------------------
L_0x00F2:
JMP L_0x00F2
Du siehst, in der Zeile stecken ev. Probleme
ORI r24,0x10 ; set ISC20
Er setzt das reserved-Bit
Und auch das stimmt nicht
ORI r24,0x18 ; set ISC20 + ISC11
Er hat statt ISC20 + ISC21 (rising)
den Flag ISC20 gesetzt (reserved)
und das falling-Bit vom INT1
Ob das tatsächlich probleme bringt, hängt vom Einzelfall ab.
Lesezeichen