Hi,

Try to add the following lines before TRISA line:

ADCON1 = 0x0f;
CMCON = 7;

This should do the trick.

This is from datasheet page 111 (and 270)

Theblond


> Hi,
> 
> I am trying to make the following code
> work when compiled by sdcc for pic18f4550
> with --no-crt.
> 
> I take care not using stack, but I guess thi is
> not  a problem given the way sdcc works.
> 
> It compiles, but at run time my led is not switched
> on (the led works well)
> 
> Could you tell me if there is something wrong with
> the code?
> 
> void _entry(void) __naked __interrupt 0
> {
>   __asm
>     goto _foo
>   __endasm ;
> }
> 
> void foo (void) __naked
> {
>   static int i = 0;
>   static int j = 0;
> 
>   __asm
>     clrf    _TBLPTRU, 0
>     bsf     0xa6, 7, 0
>     bcf     0xa6, 6, 0
>   __endasm;
> 
>   TRISA = 0;
> 
>   j = 0;
> 
>   while (1)
>     {
>       LATAbits.LATA0 = j;
> 
>       j ^= 1;
> 
>       for (i = 0; i < 200; ++i)
>         ;
>     }
> }
> 
> Regards,
> 
> Fabien.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to