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

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
  • Well, I also thought, that is these heavy functions, but I get the same, when I'm using only SBUF (I thought, this approach will be much faster, but it isn't):

    void serial_IT(void) interrupt 4
    {
    if (RI == 1)
    { /* if reception occur */
    RI = 0; /* clear reception flag for next reception */
    uart_data = SBUF; /* Read receive data */
    SBUF = uart_data; /* Send back same data on uart*/
    }
    else TI = 0; /* if emission occur */
    } /* clear emission flag for next emission*/
    

Reply
  • Well, I also thought, that is these heavy functions, but I get the same, when I'm using only SBUF (I thought, this approach will be much faster, but it isn't):

    void serial_IT(void) interrupt 4
    {
    if (RI == 1)
    { /* if reception occur */
    RI = 0; /* clear reception flag for next reception */
    uart_data = SBUF; /* Read receive data */
    SBUF = uart_data; /* Send back same data on uart*/
    }
    else TI = 0; /* if emission occur */
    } /* clear emission flag for next emission*/
    

Children
No data