This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

printf problem

still can't fix my printf problem ...

I linked the program without the option to
overlay variables and it still didn't
work ... does this eliminate the overlay
feature as a problem?

my putchar is exactly like the example on
how to do serial communications with interrupts
... my serial com is interrupt driven

I have a 22K program in a 64K code space ...
a few K of the 32K xdata ram are used ... I
use the favor small code option and have
the large memory and xdata options selected

when the printf does not work, it looks like
it is printing a series of zeros rather than
the string constants ....

I kept removing code until I could make it work
or fail ... with adding/removing one line of code

this is the info from the working version:

370 1 str[0] = 'H';
371 1 str[1] = 'V';
372 1 str[2] = '3';
373 1 str[3] = '0';
374 1 str[4] = 'X';
375 1 str[5] = 0;
376 1 printf(str);
377 //
378 1 printf ("AAAA...AAAAAAAA");

working assembly code

             ; SOURCE LINE # 376
005A 7B01          MOV     R3,#01H
005C 7A02          MOV     R2,#HIGH str
005E 799B          MOV     R1,#LOW str
0060 120FF3        LCALL   _printf
             ; SOURCE LINE # 378
0063 7BFF          MOV     R3,#0FFH
0065 7A1F          MOV     R2,#HIGH ?SC_0
0067 797E          MOV     R1,#LOW ?SC_0
0069 120FF3        LCALL   _printf
string pool:
1F7E 41414141414141414141414141414141
1F8E 41414141414141414141414141414141
1F9E 41414141414141414141414141414141
1FAE 41414141414141004133355800522566
1FBE 580056313030580057323558004A3435
1FCE 58004558000A2A2A2A204552524F5220
1FDE 2A2A2A3A2025730A000A535441545553
1FEE 3A2025730A00

info from the not working code ( string pool has moved)
          ; SOURCE LINE # 376
005A 7B01     MOV     R3,#01H
005C 7A02     MOV     R2,#HIGH str
005E 799B     MOV     R1,#LOW str
0060 120FF3   LCALL   _printf
          ; SOURCE LINE # 378
0063 7BFF     MOV     R3,#0FFH
0065 7A20     MOV     R2,#HIGH ?SC_0
0067 7902     MOV     R1,#LOW ?SC_0
0069 120FF3   LCALL   _printf

2002 41414141414141414141414141414141
2012 41414141414141414141414141414141
2022 41414141414141414141414141414141
2032 41414141414141004133355800522566
2042 580056313030580057323558004A3435
2052 58004558000A2A2A2A204552524F5220
2062 2A2A2A3A2025730A000A535441545553
2072 3A2025730A00

any ideas???????????

0