Hi, Seems very similair to a problem i had recently with an 18f4520. As someone on this mailinglist pointed out, the extended instruction set had to be disabled. To do this add _XINST_OFF_4L to the __CONFIG4L initialisation.
Regards, -Bastiaan On Thursday 30 October 2008 09:35:36 Vaclav Peroutka wrote: > Hello all, > > yesterday I experimented with printf() on PIC18F2580. I included stdio.h, I > defined void PUTCHAR(char c) and I set stdout=STREAM_USER. > > PIC sent some proper string just during the programming. But after I > switched normal supply, I got nothing on UART. But program run ok (flashing > LED loop). > > So I removed stdio.h and wrote > void printf( char * aStr) { > while (*aStr) { > PUTCHAR(*aStr); > aStr++; > } > } > > With this function I get funny characters. If I tried printf("CAN terminal > test"); , I got following sequence of characters: 0xC3, 0xC1, 0xCE, 0x20, > 0xF4, 0xE5, ... etc. Thus, with bit7 set for any character except space. If > I used PUTCHAR('C'); PUTCHAR('A'); just before printf(), for couple of > chars it went well. But then again after approx. 10 characters, it got > crazy. After I change something small (for example I add or remove one > PUTCHAR() ) the program even freezes somewhere. > > I found that strings are put into program memory and inside my printf(), > gptrget() is used. Can I have some problem with internal libraries of PIC16 > ? > > Thank you for help, > Vaclav > > ------------------------------------------------------------------------- > 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 ------------------------------------------------------------------------- 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