 |
 |
| View previous topic :: View next topic |
| Author |
Message |
future
Joined: 14 May 2004 Posts: 330
|
|
Posted: Sun Oct 31, 2004 8:39 pm |
|
|
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
|
|
Posted: Mon Nov 01, 2004 9:01 am |
|
|
| 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
|
|
Posted: Mon Nov 01, 2004 10:33 am |
|
|
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
|
|
Posted: Thu Dec 09, 2004 3:39 pm |
|
|
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); |
|
|
 |
|
|
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
|