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

18F6680 using rs232 to receive TCPIP traffic

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







18F6680 using rs232 to receive TCPIP traffic
PostPosted: Fri Oct 24, 2008 3:25 am     Reply with quote

Hi,

I'm trying to use an interrupt to catch TCPIP traffic in an rs232 communication, but sometimes 1 or 2 of the characters wont pass through properly.
Code:
#int_RDA fast
void RDA_isr()
{
// Used to handle data from TCPIP controller
   int8 con_key;  // Contains the incoming character
   
   con_key = fgetc(TCPIP );
   tick = 0;
   
   if((con_key == 85) && (con_packetstart == FALSE))
   {
      con_count = 0;
      con_packetstart = TRUE;
      con_packet[0] = con_key;
      con_count++;
   }
   else if(con_packetstart == TRUE)
   {
      con_packet[con_count] = con_key;
      con_count++;
   }
}

85 is the header, and when the packet reaches length 36, it will trigger a "Process Packet" command that calculates the CRC16 based on tte packet.
Any thoughts
Ttelmah
Guest







PostPosted: Fri Oct 24, 2008 4:22 am     Reply with quote

You cannot use int_rda 'fast', without more work. Use 'high' instead.
If you use the 'fast' keyword, the compiler _does not add the extra 'handler' code to save registers_. _You_ have to provide this. As it stands, your handler will therefore corrupt registers in other routines. As is stands, the 'big ones', will be the table address pointers, since you are using an array access in your routine.
Use the 'high' keyword instead, which does add the handler.

Best Wishes
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