On Mon, 23 Jul 2012, it would appear that Raphael Neider wrote:
>> Also, there appears to be some suspect code generated at the end
>> of the isr to restore the W register. The save code is:
>> MOVWF WSAVE
>> but the restore code is:
>> SWAPF WSAVE,F
>> SWAPF WSAVE,W
>> Shouldn't the restore code be:
>> MOVF WSAVE, W
> No, it should not. The restore sequence is from the datasheet (Example
> 12-1, DS41202F, page 109). MOVF would ruin STATUS<Z> ...
> I'll have to look deeper into the generated .asm stuff to analyse the
> "hang" you experience, which would be easier if you provided
> sources/assembly output.
I've attached a zip file containing a source file, itest.c as well as
two asm files, itest.asm containing the original sdcc generated code,
and a modified itest1.asm, in which I've commented out the state save/
restore code around the isr. The modified code works, the original
The program is pretty simple, the main loop continually inverts the
state of RA5, the isr is triggered on the falling edge of INT, and
inverts the state of RA1. I've been programming in assembly for a
while and am trying to learn embedded c, so maybe I'm just doing
something wrong here?
Let me know if you need any additional information. Thanks.