Hi All,
I have the following problem with the PIC18F4550. The EUSART is initialized as follows: movlw b'11111111' movwf TRISC,ACCESS movlw low(d'1249') movwf SPBRG,ACCESS movlw high(d'1249') movwf SPBRGH,ACCESS movlw b'00000100' movwf TXSTA,ACCESS movlw b'10000000' movwf RCSTA,ACCESS movlw b'00001000' movwf BAUDCON,ACCESS bsf PIE1,RCIE,ACCESS bsf IPR1,RCIP,ACCESS bsf RCSTA,CREN,ACCESS
Then the interrupts are enabled: bcf RCON,IPEN,ACCESS bsf INTCON,PEIE, ACCESS bsf INTCON,GIE, ACCESS
(I have also tried the version with interrupt priority switched on, that's why I have "bsf IPR1,RCIP,ACCESS", howeve this is simply ignored when " bcf RCON,IPEN,ACCESS" is used).
The result is however, that PIC doesn't call the interrupt routine. I have a special variable to detect if the routine was ever called:
Code at 0x08: call HiIrq,FAST
HiIrq: pop ; According to the errata 80220g.pdf banksel int_flag setf int_flag, BANKED call ser_rx_irq retfie FAST
The int_flag variable is still equal to 0 (set in the initial code). However I can see, that the INTCON is set to 0xc5, and that EUSART receive something on the serial line (RCSTA contains initially 0x90, than 0x94 - , later 0x96 - ) The RCIF is also set (PIR1 contains 0x20), and RCIE as well (PIE1 contains
0x20).How is it possible, that with INTCON set to 1, INTCON set to 1, and both RCIE and RCIF set to '1' the interrupt routine is not called?
The PIC does not hang, as the USB code, which I use for debugging works perfectly.
-- TIA & regards, Wojtek Zabolotny snipped-for-privacy@ise.pw.edu.pl