Gast
#2508357
org 4
intvec
bcf INTCON, GIE ; disable Interupt
MOVWF W_TEMP ;Copy W to TEMP register
SWAPF STATUS,W ;Swap status to be saved into W
;Swaps are used because they do not affect the status bits
MOVWF S_TEMP ;Save status to bank zero STATUS_TEMP register
;
BTFSS INTCON,INTF ; Übergehe wenn INTF = 1 ; wechsel an Port RB0
GOTO Next1 ;
MOVLW B'00000001' ; RA0 mit xor vernüpfen
XORWF PORTA,1 ; invertieren von RA0
bcf INTCON, INTF ; RB0-Interrupt-Flag löschen
bsf PORTA,B'00000100'
GOTO Int_End
Next1
BTFSS INTCON,T0IF
GOTO Next2
MOVLW B'00000010' ; RA1 mit xor vernüpfen
XORWF PORTA,1 ; invertieren von RA1
bcf INTCON,T0IF ; Timer0 Flag wieder setzen
GOTO Int_End
Next2
Int_End
bsf INTCON, GIE ; ensable Interupt
SWAPF S_TEMP,W ;Swap STATUS_TEMP register into W
;(sets bank to original state)
MOVWF STATUS ;Move W into STATUS register
SWAPF W_TEMP,F ;Swap W_TEMP
SWAPF W_TEMP,W ;Swap W_TEMP into W
; Intrupt servic routine
Int_serv
RETFIE
;**************************************************************
; Port A/B auf Ausgabe stellen
Init
; Port RA0 auf Ausgabe stellen
clrf PORTA ; LED aus
bsf STATUS, RP0 ; auf Bank 1 umschalten
movlw B'00000000' ; PortA RA0-RA3 output
movwf TRISA
movlw B'00000000' ; PortA RA0-RA3 output
movwf TRISB
movlw B'00000011' ; PortA RA0-RA3 output
movwf TRISB
bcf STATUS, RP0 ; auf Bank 0 zurückschalten
; RB0-Interrupt einstellen
bsf STATUS, RP0 ; auf Bank 1 umschalten
bsf OPTION_REG, INTEDG ; 0-1-Flanke an RB0
bcf OPTION_REG, T0CS
bcf STATUS, RP0 ; auf Bank 0 zurückschalten
bcf INTCON,T0IE ; Timer 0 einschalten !!!!!!
bsf INTCON, INTE ; RB0-interrupt erlauben
MOVLW B'00001111'
MOVWF PORTA
NOP
NOP
NOP
MOVLW B'00000000'
MOVWF PORTA
bsf INTCON, GIE ; Interrupt generell erlauben
loop goto loop ; eine Endlosschleife
;**********************************************************
end
Hallo es handelt sich hierbei um einen PIC16F887
Eigentlich sollte die Interruptschleife "INTF",
wenn ich ein 5V Potential auf RB0 gebe richtig
aufgerufen werden, beim PIC16F84A funktionierte dies.
Übersehe ich was.
Martin Michael