From: Theblond <the...@fr...> - 2008-11-26 06:13:08
|
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. |