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 CCS Technical Support

Corrupted Array

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



Joined: 07 Dec 2007
Posts: 8

View user's profile Send private message

Corrupted Array
PostPosted: Mon Dec 17, 2007 10:13 am     Reply with quote

I have just completed a search of the forums and have not found an answer to this: I am talking to another CPU via the uart. I have declared the array as a global variable. The first time I read the string, it is fine. Loaded all characters correctly. If I try to load array again, the data is corrupted and never loads correctly again. Any help would be welcomed!

PIC 16F876
CCS Ver 4.023

Code: Just the function listed. Am I doing something stupid?

Code:
void Get_String(void)
{
   int8 i = 0;
   Read_Rx();// clear rxreg, reading x3
   Rx_Tmr_On();
   while((i<=17)&& (int_count<=6))
   {
      rx_buffer[i]=getg();
      i++;
   }
   Rx_Tmr_Off();
   
   printf(lcd_putc,"\n");
   i=0;
   while(i<=10)
   {
     printf(lcd_putc,"%c",rx_buffer[i]);
      i++;
   }
}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Dec 17, 2007 12:03 pm     Reply with quote

You didn't give us enough information.
1. Post all your variable declarations, such as the rx_buffer[] array.
2. Post the routines that you're calling, such as "getg()", etc.
If you're using RDA interrupts to receive the characters, then post the isr.

Here's one thread where I explain problems with incorrect buffer
contents. But without more information, I can't be sure if it applies
to your case.
http://www.ccsinfo.com/forum/viewtopic.php?t=25425
rlgreen



Joined: 07 Dec 2007
Posts: 8

View user's profile Send private message

PostPosted: Mon Dec 17, 2007 6:48 pm     Reply with quote

Thanks PCM for the reply. I was doing something stupid. Not clearing the overflow bit. The uart doesn't like that.

Thanks again!
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