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

Does interrupt dispatcher tests all interrupts?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Sun Oct 31, 2004 8:39 pm     Reply with quote

If this is true, the compiler is doing by itself... the only function that has a "fast" is the timer2.

Code:
#int_timer2
void timer2_isr(void) {

0000:  GOTO   0A8A
0008:  MOVWF  05
000A:  MOVFF  FD8,06
000E:  MOVF   FE9,W
0010:  MOVWF  07
0012:  MOVF   FEA,W
0014:  MOVWF  08
0016:  MOVF   FE1,W
0018:  MOVWF  09
...
...



Code:
#int_timer2 fast
void timer2_isr(void) {

0000:  GOTO   0A8A
0008:  GOTO   059C
000C:  NOP
000E:  NOP
0010:  NOP
0012:  NOP
0014:  NOP
0016:  NOP
0018:  MOVWF  05
...
...
.... #int_timer2 fast
.... void timer2_isr(void) {
....    mms++;
059C:  MOVLB  1
059E:  INCF   x01,F
...
...
.... void main() {
0A8A:  CLRF   FF8


Weird!
ckielstra



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

View user's profile Send private message

PostPosted: Mon Nov 01, 2004 9:01 am     Reply with quote

Quote:
If this is true, the compiler is doing by itself... the only function that has a "fast" is the timer2.

This is a strange 'feature' of the PIC18 series hardware. For INT_EXT you can not select the priority level, if you use high priority interrupts in your program than INT_EXT becomes high priority as well !!
So in the situation where you have both a FAST interrupt AND you are using INT_EXT, than both interrupts will become high priority interrupts. There is nothing much the compiler can do about this, except it would be nice to get a warning message.

The CCS compiler doesn't have support for multiple FAST interrupts so you will have to build your own interrupt dispatcher (again, and this is just what we wanted to avoid...)

If possible, it's easier to change your hardware and move the interrupt from the int_ext to int_ext1 pin?
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Mon Nov 01, 2004 10:33 am     Reply with quote

Yea you are right!

Quote:
Interrupt priority for INT1 and INT2 is determined by the
value contained in the interrupt priority bits, INT1IP
(INTCON3<6>) and INT2IP (INTCON3<7>). There is
no priority bit associated with INT0. It is always a high
priority interrupt source.


I took all ext code off, set timer2 to fast and it works...

It must have a simple solution, maybe I clear flags myself or put a flag test (just 2 instructions I think).

Modifying the hardware will be hard as there are some boards already built, maybe in the next board revision...
future



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

PostPosted: Thu Dec 09, 2004 3:39 pm     Reply with quote

Well, board rebuilt and ext1 fast working...

It seems that the problem wasnt with ext0, but with reading timer0.

Code:
..in ext1 handler:

abcd=get_timer0( );

....................             abcd=get_timer0( );
0740:  MOVF   TMR0L,W
0742:  MOVFF  TMR0H,03
0746:  MOVWF  abcd
0748:  MOVFF  03,abcd+1


If you remember from previous posts all the problems related with ext0 fast, the problem is that get_timer0(); uses the scratch register 3.

Solved with:

Code:
     // aperiod=get_timer0();
        aperiodl=TMR0L;
        aperiodh=TMR0H;
        aperiod=make16(aperiodh,aperiodl);
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2
Page 2 of 2

 
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