CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

int_rda need help!

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Pic_Newbie



Joined: 13 Feb 2004
Posts: 1

View user's profile Send private message

int_rda need help!
PostPosted: Fri Feb 13, 2004 12:47 am     Reply with quote

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.
Ttelmah
Guest







Re: int_rda need help!
PostPosted: Fri Feb 13, 2004 3:11 am     Reply with quote

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
Guest








PostPosted: Sat Feb 14, 2004 1:29 am     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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