PIC 18F4550 - EUSART does not generate interrupts
- From: wzab <wzab01@xxxxxxxxx>
- Date: Wed, 30 Jul 2008 13:46:20 -0700 (PDT)
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
.
- Follow-Ups:
- Prev by Date: Re: arm9e: how do I invert sign of a halfword?
- Next by Date: Re: Embedded processor selection for long-life product
- Previous by thread: Re: Affordable PCB Layout Software ???
- Next by thread: Re: PIC 18F4550 dooes not respond to interrupts at all :-(
- Index(es):
Relevant Pages
|