RS232 data transmit\receive: very slow speed

I have connected some software and Keil µVision Simulator of generic 8051 via 2 Serial COM-ports(RS232). Simulator executes the standard example called INTSIO2 (I have downloaded it from here). The only thing I changed is that it receives a formatted string and extracts a value of a float data type. Here is the edited main function:

void main (void)
{
com_initialize ();
com_baudrate (38400);
EA = 1; /* Enable Interrupts */
while (1){
  char buf [10];
  int argsread;
  float f;
  if (argsread = scanf ("start;%s  ;end", buf)){
    f = atof(buf);
    printf("start;%8g;end", (float)f);
    }
  }
}

The main problem: simulator receives these strings very slow, much slower, than the program can transmit. Even when I just closed the program so it doesn't transmit anymore, the simulator keeps receiving values the program sent before for a several seconds.

Can you help me, how the speed performance of a program can be improved?

Parents
  • Next time it is better if you provide convenient reference to the used example.
    Actually, you did replace light versions of interface functions to heavy monsters: scanf, atof and printf.
    Each of that functions takes lots of power and time from tiny 8 bit processor. You should try avoid to use that functions in embedded world.
    Also to increase performers you can try create your own light replacement for that.

Reply
  • Next time it is better if you provide convenient reference to the used example.
    Actually, you did replace light versions of interface functions to heavy monsters: scanf, atof and printf.
    Each of that functions takes lots of power and time from tiny 8 bit processor. You should try avoid to use that functions in embedded world.
    Also to increase performers you can try create your own light replacement for that.

Children
More questions in this forum