|
|
View previous topic :: View next topic |
Author |
Message |
steaky1212 Guest
|
18F6680 using rs232 to receive TCPIP traffic |
Posted: Fri Oct 24, 2008 3:25 am |
|
|
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
|
|
Posted: Fri Oct 24, 2008 4:22 am |
|
|
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 |
|
|
|
|
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
|