![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
Pic_Newbie
Joined: 13 Feb 2004 Posts: 1
|
int_rda need help! |
Posted: Fri Feb 13, 2004 12:47 am |
|
|
Hi everybody,
I'm having a problem with int_rda, i read the USART using getc() but the RCIF flag is not cleared causing the interrupt to occur over and over. Isn't this flag is supposed to be cleared when you read the USART?
I only tried to send only one character to the PIC, so this cannot be a buffer overflow, right?
I'm using a PIC18F452 and compiler v3.182.
Thanks for your support. |
|
![](templates/subSilver/images/spacer.gif) |
Ttelmah Guest
|
Re: int_rda need help! |
Posted: Fri Feb 13, 2004 3:11 am |
|
|
Pic_Newbie wrote: | Hi everybody,
I'm having a problem with int_rda, i read the USART using getc() but the RCIF flag is not cleared causing the interrupt to occur over and over. Isn't this flag is supposed to be cleared when you read the USART?
I only tried to send only one character to the PIC, so this cannot be a buffer overflow, right?
I'm using a PIC18F452 and compiler v3.182.
Thanks for your support. |
No, the interrupt flag is cleared when you leave the interrupt routine, not when you read a character. The event that led to it being set, is cleared by the reading, so it won't be reset. The repeated interrupt, tends to suggest the chip is seeing multiple characters. One 'classic', would be if you have taken RS232, and wired it with current limiting circuitry direct to the chip, without an inverter. Then the chip will sit continuously receiving 'blank' characters, when the line is idle.
Try the experiment, of not using the interrupt, and setting up a 'diagnostic' loop in the main code. Something like:
Code: |
int8 temp,toggle;
/initialisation code here
while (true) {
temp=getc()
toggle ^=1;
output_a(toggle);
}
|
Bit 0 of portA, should toggle on and off for each character that is 'seen'. If this is flashing at about 1/10th your baud rate, then it implies a hardware problem.
Best Wishes |
|
![](templates/subSilver/images/spacer.gif) |
Guest
|
|
Posted: Sat Feb 14, 2004 1:29 am |
|
|
I Tried your experiment and it does not flash, so that's good news.
I forgot to mention that i'm using a MAX232 to convert signals to TTL levels. |
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|