Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

scanf

Status
Not open for further replies.

tomand

Electrical
Feb 26, 2004
11
0
0
CA
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
 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top