|
|
View previous topic :: View next topic |
Author |
Message |
NikkariB Guest
|
external interrupt problem when receiving serial data |
Posted: Fri Feb 11, 2005 10:55 am |
|
|
#USE rs232(baud=9600, PARITY=N, bits=8, xmit=PIN_B0, rcv=PIN_B0, stream = PBUS, float_high)
...
#int_ext
void pbus_isr()
{
byte data;
if (kbhit(PBUS))
{
data=fgetc(PBUS);
SerLog[ser_next_in]=data;
ser_next_in = (ser_next_in + 1) % SerLogLength;
}
}
I am using the B0 port to transmit/receive serial data from another microprocessor. My ISR above just pulls bytes into a FIFO buffer that I deal with later on. It doesn't appear that the ISR is occuring quick enough because I get garbage data coming in, but if I add a while loop around the if kbhit() statement that keeps checking the port , then my data comes in fine. It seems that as soon as it leaves the ISR, it takes too long to get back in and bytes are missed.
Where can I view/control the data that gets stacked when the ISR routine kicks in ?
What is strange is that this never used to be a problem, but I can't remember which rev of compiler I was using when I last had it running. Also, I used to have much more in the int_ext routine that parsed the message as it came in, with no problems !
(using PIC18F252 and v3.212 of compiler, although I have tried later compiler versions with no luck) |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Feb 11, 2005 2:53 pm |
|
|
Quote: |
It seems that as soon as it leaves the ISR, it takes too long to get back in
and bytes are missed.
Where can I view/control the data that gets stacked when the ISR routine kicks in ? |
Look in the .LST file generated by the compiler. Look at address 0008
for the start of the interrupt dispatcher code.
Also, if you disable interrupts for any substantial period of time, you
could cause the problem that you're seeing. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
|
Humberto
Joined: 08 Sep 2003 Posts: 1215 Location: Buenos Aires, La Reina del Plata
|
|
Posted: Fri Feb 11, 2005 5:10 pm |
|
|
NikkariB wrote:
Quote: |
(using PIC18F252 and v3.212 of compiler, although I have tried later compiler versions with no luck)
|
FYI, I have projects that doesn�t run with V3.212. I�m still using V3.190
Humberto |
|
|
|
|
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
|