PIC 18F4550 - EUSART does not generate interrupts



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 - <frame error>, later 0x96 - <frame error & data lost>)
The RCIF is also set (PIR1 contains 0x20), and RCIE as well (PIE1
contains
0x20).

How is it possible, that with INTCON<7> set to 1, INTCON<6> 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
wzab@xxxxxxxxxxxxx
.



Relevant Pages

  • Pic Eusart behaviour
    ... I know the timer is working by scoping the A1 pin. ... config XINST = OFF ... movwf TRISA ... movlw 0xFF; make PORTB all input ...
    (sci.electronics.basics)
  • Re: KeyPad Lock made from a 16F84A trouble
    ... A key pad combination controlled lock. ... > STATUS equ 03h ... > movlw 01h ... > movwf NUM1 ...
    (sci.electronics.design)
  • PIC18f4331 PWM Problem
    ... observing the output from an oscillator, some pins do not produce the ... MOVLW 0x00 ... MOVWF TRISA ... movwf OVDCONS ...
    (sci.electronics.design)
  • Re: Vehicle control design
    ... movwf TMR0 ...
    (sci.electronics.basics)
  • Re: A/D code on a PIC
    ... MOVWF TRISA ... CLRF TRISC; Make PortC digital out ... BSF ADCON2,2; Fosc/4 ... set A/D to channel defined in WREG ...
    (sci.electronics.basics)