I examined the compiled code, and I found a big problem in it. That is
caused by the assembly parts of the wait function.
Here we are:
clrwdt
movlw 0x42
movwf 0
decfsz 0, f
goto 0x102
nop
If you are using pointers the compiler will use the FSR register for
it. In your code you are using the 0x00 reg which is the INDF reg. The
FSR is pointed of the last used register which should be actually the
(*s). That register will be used trough INDF in your delay routine. So
that cause the problem.
It is unusual to make cblock into inline assembly. You have to make a
global variable for using this type of delay routine. You have to use
BANKSEL also.
For example:
unsigned char d1;
void wait(long time)
{
for(i=0;i<time;i++)
{
__asm
clrwdt
movlw 0x42
BANKSEL _d1
movwf _d1
decfsz _d1, f
goto $-1
nop
__endasm;
}
}
Inline assembly could cause lot of problem.
Zsolt
2011/11/7 Gál Zsolt <[email protected]>:
> Hello Jason an KHMan,
>
> I would like to ask You, which version of SDCC are used to translate
> this program and please send the command line used for compiling it.
>
> Zsolt
>
--
~~~~~~~~~~~~~~~~
http://galzsolt.zzl.org
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user