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

RDA vs EXT

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



Joined: 23 Apr 2004
Posts: 14
Location: Pescara (Italy)

View user's profile Send private message

RDA vs EXT
PostPosted: Wed Jul 14, 2004 1:47 am     Reply with quote

I use a 16F648A with PCW 3.157.
In my program there's a isr for USART rx and it works well.
If in the program I add isr for external interrupt than the isr_RDA doesn't work.
This is true also if I don't enable ext interrupt.

This works:
Code:
....
int_RDA
isr_rda{
...
}
main(){
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
...
}


This doesn't work:
Code:
....
int_EXT
isr_ext{
}
int_RDA
isr_rda{
...
}
main(){
enable_interrupts(INT_RDA);
//enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
...
}
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Jul 14, 2004 2:03 am     Reply with quote

Edited: Obsolete remark removed.

Last edited by ckielstra on Wed Jul 14, 2004 2:34 am; edited 1 time in total
carlosma



Joined: 24 Mar 2004
Posts: 53
Location: Portugal

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Wed Jul 14, 2004 2:19 am     Reply with quote

Hello Lorenzo:

I have a program with 2 Uart and works fine
I think your program need some alterations
see the example:

Code:

#use rs232(baud=1200, xmit=PIN_C6, rcv=PIN_C7,  STREAM=COM_B, ERRORS)  //hardware
#USE RS232(BAUD=9600, XMIT=PIN_B1, RCV=PIN_B0, STREAM=COM_A)//software
....
#int_EXT
isr_ext()
{
//...
 
}
#int_RDA
isr_rda()
{
//...
}
main(){
enable_interrupts(INT_RDA);
enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
...
}
Ttelmah
Guest







Re: RDA vs EXT
PostPosted: Wed Jul 14, 2004 7:15 am     Reply with quote

Lorenzo wrote:
I use a 16F648A with PCW 3.157.
In my program there's a isr for USART rx and it works well.
If in the program I add isr for external interrupt than the isr_RDA doesn't work.
This is true also if I don't enable ext interrupt.

This works:
Code:
....
int_RDA
isr_rda{
...
}
main(){
enable_interrupts(INT_RDA);
enable_interrupts(GLOBAL);
...
}


This doesn't work:
Code:
....
int_EXT
isr_ext{
}
int_RDA
isr_rda{
...
}
main(){
enable_interrupts(INT_RDA);
//enable_interrupts(INT_EXT);
enable_interrupts(GLOBAL);
...
}

There is no visible 'software' reason why what you describe wouldn't work. The most likely problems, are if there is noise on the external interrupt signal, so it is being effectively continuously triggered, which is then preventing the second interrupt handler being called, or that the handler for the external event has a fault, resulting in the processor staying in this routine for a long time (post the code). Interrupt routines _must_ in general be short. If (for instance), the external handler was taking several mSec to execute, then the hardware UART, could well have experienced a comm overrun error, and will hang, if this is not cleared (either by you, or using the 'ERRORS' option in the RS232).

Best Wishes
Lorenzo



Joined: 23 Apr 2004
Posts: 14
Location: Pescara (Italy)

View user's profile Send private message

PostPosted: Wed Jul 14, 2004 8:37 am     Reply with quote

There isn't noise and however the EXT interrupt is disabled.
Ttelmah
Guest







PostPosted: Wed Jul 14, 2004 9:05 am     Reply with quote

Lorenzo wrote:
There isn't noise and however the EXT interrupt is disabled.

As I said, _post the code_.
What you have posted so far, will work. Hence there is something else causing the problem.
Adding the second handler, only increases the latency for the RS232 interrupt by about five instruction cycles, but if (for instance), you are running with a slow clock, or a very high interrupt rate, this could be significant.

Best Wishes
Guest








PostPosted: Wed Jul 14, 2004 11:25 am     Reply with quote

Maybe it's just a typo but you don't have '#' right before the int:
#int_ext
#int_rda
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