| ??? 01/28/03 19:15 Read: times |
#37566 - RE: problem in SDCC printf_small |
Hi,
Just solve this !!(A sprintf problem) Without sprintf the program gets compiled and runs well. # include<8051.h> # include<stdio.h> # include<stdlib.h> # include<string.h> typedef unsigned char byte; typedef unsigned int word; typedef unsigned long l_word; unsigned char mess[12]; volatile data byte timer; volatile data byte hi_flag; float fl1=1.1; float fl2=1.2; float fl3; //extern int vprintf(const char *,char *); //extern char putchar(char); // timer0 using register bank 2 void timer0_irq_proc(void) interrupt 1 using 2 { if(timer != 0) { --timer; } else { hi_flag=1; timer=250; } TR0=0; TH0=(~(5000)) >> 8; TL0=(~(5000)) & 0xff; TR0 = 1; } #if 0 // UART initialisation using register bank 1 void uart0_int(void) interrupt 4 using 1 { if(RI) { c=SBUF; RI=0; } } #endif void tx_char(char c) // send a character to output { SBUF = c; while(!TI) ; TI=0; } //void putchar(char c) //{ // SBUF = c; // while(!TI) // ; // TI=0; // return 0; // return(c); //} void tx_str(char *str) // send a string to output { while(*str) { tx_char(*str++); } } void stop(void) { _asm; mov dptr,#0XA000; movx a,@dptr; nop; _endasm; } void main(void) { // serial port initialisation done here PCON=0x80; SCON=0x50; TMOD=0x21; TCON=0; TH1=0xF6; TR1=1; TR0=1; ET0=1; EA=1; TI=0; // SBUF='.'; hi_flag=1; fl3=fl1+fl2; sprintf(mess,"%c","a"); // tx_str(mess); // strcpy(mess,fl3); for(;;) { if(hi_flag) { tx_str("Hi da n"); hi_flag = 0; } stop(); } } I get the error as : ASxxx error - Unresolved global _putchar referred by module vprintf . How to solve this ??? I know that this problem is due to sprintf usage . How to use sprintf in my program , so that i can transfer it through my serial port using tx_str() routine ? karthik bala guru sdcckarthik@yahoo.com |
| Topic | Author | Date |
| problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
| RE: problem in SDCC printf_small | 01/01/70 00:00 | |
RE: problem in SDCC printf_small | 01/01/70 00:00 |



