Hi Rodrigo,
> Variations #0 and #2 work fine on the device but variation #1 doesn't
> turn any led on. Strangely, when testing variation #1 with gpsim it
> seems to work fine (the command "symbol _PORTA" returns 0b00000000 and
> the same for PORTB).
So then, you might try to test your code variations with interrupts
disabled (the interrupt assembly code looks good, but...).
Further you might try `Variation #1a' below, which includes __gptrget
but not __gptrput.
You also seem to not set any configuration bits. Maybe (though
improbable) you are bitten by the watchdog in the longer code
(__gptrputX and __gptrgetX add some cycles compared to dereferencing a
__data pointer)?
>From the data sheet I gather that a default value in the CONFIG2L
register enables Brown-Out Reset but specifies a `reserved' threshold
voltage. Your other code fragments, work though, so this should not be
the cause of your problems either...
Variation #1a:
-=-=-=-=-=-=-=-=-
/* sample code to setup CONFIG bits */
unsigned char __at(__CONFIG2H) conf2h = _WDT_DISABLED_CONTROLLED_2H;
void main(void)
{
unsigned char c;
unsigned char *p;
init();
c = 0x12; // initialized to match below
p = &c;
LATA = 0x10; // turn off green led
LATB = 0x10; // turn off orange led
if (*p == 0x12) LATA = 0x00; // turn on green led
if (c == 0x12) LATB = 0x00; // turn on orange led
}
Good luck in finding the bug (I am pretty much out of ideas by now),
Raphael
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sdcc-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sdcc-user