Truncated match.
PICList
Thread
'Interrupt problems with 16C74'
1996\11\17@141530
by
Jim Main
For some reason, my interrupts have stopped working.
I think it's something to do with Program memory bank 1 - my code's
gotten to the stage where I've had to start dumping routines into the
second bank - calling them from the first bank.
When I call a routine in bank 1 and loop there waiting for an interrupt
driven timer to time out, it never does - it just goes round and round
the loop. The SCI interrupt and the keyboard interrupt don't work
either.
What's happening? I've checked and double checked that GIE is set and
doesn't get disabled anywhere else - and I presume that when an
interrupt happens when the code's in page 1 that it'll still jump back
to the interrupt vector at 04h.
I'm saving context ok in the interrupt (W,Status,FSR and PCLATH) - and
in fact the interrupt code never seems to get run at all (I put a port
flag in to check and it never gets set)
Any ideas?
--
Jim
1996\11\17@234508
by
Steve Hardy
|
> From: Jim Main <spam_OUTjimTakeThisOuT
EWCOMM.DEMON.CO.UK>
>
> For some reason, my interrupts have stopped working.
>
> I think it's something to do with Program memory bank 1 - my code's
> gotten to the stage where I've had to start dumping routines into the
> second bank - calling them from the first bank.
>
> When I call a routine in bank 1 and loop there waiting for an interrupt
> driven timer to time out, it never does - it just goes round and round
> the loop. The SCI interrupt and the keyboard interrupt don't work
> either.
>
> What's happening? I've checked and double checked that GIE is set and
> doesn't get disabled anywhere else - and I presume that when an
> interrupt happens when the code's in page 1 that it'll still jump back
> to the interrupt vector at 04h.
GIE is not the only flag. The individual int enables must be set.
>
> I'm saving context ok in the interrupt (W,Status,FSR and PCLATH) - and
> in fact the interrupt code never seems to get run at all (I put a port
> flag in to check and it never gets set)
>
> Any ideas?
> --
> Jim
>
Will need to see your code to help further. Have you checked your
assembler listing to ensure code is at the expected places? What
PIC are you using and what development environment simulator or emulator?
Regards,
SJH
Canberra, Australia
1996\11\18@130226
by
Bob Blick
|
I've got no experience with the problem you're outlining, but here's what
I'd look at:
Have you tried making the interrupt service routine immediately turn on an
LED, not even save any registers, to see if the interrupt is really getting
called?
Do you have mirrored registers in both bank 0 and 1 for saving the status
register in? You might be accidentally trashing a register you're using for
something else.
Neither of these addresses the use of code in the second page of memory,
which if what you said started the problem, but maybe you started using the
second bank of registers about the same time as you started using the second
page of ROM, and you're looking in the wrong place for the problem.
Cheers, Bob
{Quote hidden}>For some reason, my interrupts have stopped working.
>
>I think it's something to do with Program memory bank 1 - my code's
>gotten to the stage where I've had to start dumping routines into the
>second bank - calling them from the first bank.
>
>When I call a routine in bank 1 and loop there waiting for an interrupt
>driven timer to time out, it never does - it just goes round and round
>the loop. The SCI interrupt and the keyboard interrupt don't work
>either.
>
>What's happening? I've checked and double checked that GIE is set and
>doesn't get disabled anywhere else - and I presume that when an
>interrupt happens when the code's in page 1 that it'll still jump back
>to the interrupt vector at 04h.
>
>I'm saving context ok in the interrupt (W,Status,FSR and PCLATH) - and
>in fact the interrupt code never seems to get run at all (I put a port
>flag in to check and it never gets set)
>
>Any ideas?
>--
>Jim
>
>
1996\11\18@134344
by
Shawn Ellis
|
{Quote hidden}>>For some reason, my interrupts have stopped working.
>>
>>I think it's something to do with Program memory bank 1 - my code's
>>gotten to the stage where I've had to start dumping routines into the
>>second bank - calling them from the first bank.
>>
>>When I call a routine in bank 1 and loop there waiting for an interrupt
>>driven timer to time out, it never does - it just goes round and round
>>the loop. The SCI interrupt and the keyboard interrupt don't work
>>either.
>>
>>What's happening? I've checked and double checked that GIE is set and
>>doesn't get disabled anywhere else - and I presume that when an
>>interrupt happens when the code's in page 1 that it'll still jump back
>>to the interrupt vector at 04h.
>>
>>I'm saving context ok in the interrupt (W,Status,FSR and PCLATH) - and
>>in fact the interrupt code never seems to get run at all (I put a port
>>flag in to check and it never gets set)
>>
>>Any ideas?
>>--
>>Jim
>>
>>
Sounds like your program may be getting a little large for .asm. If speed
is not too critical, you might consider a "C" compiler from CCS. It will
handle page bank switching and interrupts for you and it's only $100. It
saved me mountians of time!
1996\11\18@170845
by
TONY NIXON 54964
|
These problems can be very hard to trace, especially in large multi
page programs.
As the processor is very obedient, it likes to do what it is told and not what
we want it to do. It sounds as though you forgot to set/reset a ROM or RAM
page bit correctly when you transferred your code to the upper page.
This may be painstaking, but you may have to trace your code through
with MPSIM. Set a break point at the first instruction of the
interupt routine and see if it does break at that point. If it does,
follow your code through the interupt. If it doesn't get to the
interupt break point you will have to monitor your code to see if
a page bit is changed to the wrong state. Make sure that the status
etc. are restored correctly after the IRQ.
I would concentrate on monitoring the code that you moved. You can also
try 'steering' the program to code that you want to test by using GOTO's to
bypass excessive timing loops etc. and to test certain code fragments.
This makes debugging a little easier with larger programs
FrUstratioN is part of the fun of programming.
Hope this helps
Tony
Just when I thought I knew it all,
I learned that I didn't.
1996\11\19@151812
by
Jim Main
>Have you tried making the interrupt service routine immediately turn on an
>LED, not even save any registers, to see if the interrupt is really getting
>called?
Solved it! Your suggestion put me on the right track.
What was happening was - the interrupt happened only once and then never
again. I'd correctly implemented the context saving bits of code - but
I'd forgotten to explicitly clear PCLATH,3 after saving PCLATH to a
temp_lath register. So, if PCLATH,3 was set and an interrupt occured
(as it would when I was looping around in page 1), then the first GOTO
in the interrupt routine would jump to page 1 (shortly before the loop
as it happened!) and since the RETFIE never happened, the interrupt
never happens again, and it just loops indefinitely.
Easy in hindsight isn't it!!!
--
Jim
1996\11\19@220911
by
Dwayne Reid
|
>For some reason, my interrupts have stopped working.
>
>I think it's something to do with Program memory bank 1 - my code's
>gotten to the stage where I've had to start dumping routines into the
>second bank - calling them from the first bank.
>
>When I call a routine in bank 1 and loop there waiting for an interrupt
>driven timer to time out, it never does - it just goes round and round
>the loop. The SCI interrupt and the keyboard interrupt don't work
>either.
snip
>I'm saving context ok in the interrupt (W,Status,FSR and PCLATH) - and
>in fact the interrupt code never seems to get run at all (I put a port
>flag in to check and it never gets set)
One idea: do you do something like:
org 04
goto interrupt
If so, the goto is the problem... pclath is pointing to ROM Pg1 and you jump
to somewhere not intended. The way that I handle it is to put all the
context saving stuff right at the start as follows:
ORG 00H
goto COLDBOOT
ORG 04H
;save W, STATUS, PCLATH, FSR
movwf W_SAVE ;save w (could be on either ram page)
movfw STATUS ;status register now trashed
clrf STATUS ;ensure ram page 0
movwf S_SAVE ;good copy of status register in Page 0
movfw PCLATH ;remember to also save FSR if necessary
movwf P_SAVE
clrf PCLATH ;ensure ROM page 0
;which interrupt? Parse interrupt flags here to reduce jumps (and time)
btfsc INTF ;RB0 interrupt?
goto RB0_ISR
btfss T0IF ;timer 0 interrupt?
goto TMR0_ISR
goto INT_END ;this shouldn't happen!
;jump tables live here
;interrupt routines live here
More... (looser matching)
- Last day of these posts
- In 1996
, 1997 only
- Today
- New search...