tomand
Electrical
- Feb 26, 2004
- 11
scanf take alot of program memory. I need to find an alternative to scanf. I need to read two numbers from seial port, add them and present the result.
As an example, I had the same problem with printf and at last found this code example:
void send_serial(unsigned char *s)
{while(*s != 0x0)
{
SBUF=*s; /*send out the character*/
while(!TI) /*wait until sent*/
{ }
TI=0;
s++; /*get the next character*/
}
}
This code takes much less space.
Thanks
Tom
As an example, I had the same problem with printf and at last found this code example:
void send_serial(unsigned char *s)
{while(*s != 0x0)
{
SBUF=*s; /*send out the character*/
while(!TI) /*wait until sent*/
{ }
TI=0;
s++; /*get the next character*/
}
}
This code takes much less space.
Thanks
Tom