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

first byte in serial port is nonsense

Hello,

I'm using transmit interrupt to update the data for the serial port (ASC0) in XC164CM. The sent function and ISR are defined as following:

void ASC0_vSendData_LCD(unsigned char *lcd_data, unsigned char lcd_number)
  {
        ASC0_vSendData(lcd_data[0]);
        rest_number = lcd_number - 1;
  }

void ASC0_viTx(void) interrupt ASC0_TINT using RB_LEVEL15
{
  static unsigned char i = 1;
  if (i <= rest_number)
  {
        ASC0_TBUF = lcd_data[i];
        i++;
  }
  else
  {
        i = 1;
  }
}

In this function only the first byte will be sent. After this the ISR will be called automatedlly. The problem is that the first sent byte is always nonsense. From the second byte everything goes well. Does anyone have a suggestion to solve it?

Thanks
Senmeis