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

Problem with serial port interrupt in MSC1211y5

I am working with Msc1211y5, 24 bit A2D with 8051 microcontroller. In my program, I have enabled A2D and timer 0 interrupts. When I also enable serial port 0 interrutps(Both send and receive are enabled with a same flag) the speed of executing the program is reduced. This happeds also when we do not send any data to msc1211y5, and trasmitting data by msc1211y5 is done with "printf" command. It seems that TI_0 is set and program jump to serial port 0 ISR. Clearing TI_0 in ISR also cause the program not send any data to serial port and it seems the program stay in ISR. We use the Keil software to compile our programs.

Could somebody please explain me such behavior?

Parents Reply Children
  • Hi Erik,
    Thanks for your message:
    MY serial ISR ia as below, do you think it is defective?

    void USART0_handler(void) interrupt 4 using 3
    {
    unsigned char res;
    int j;

    if(RI_0)
    {
    Rcve_Buffer[Num_Byte_Rcve++] = SBUF0;
    if (Num_Byte_Rcve > 200)
    {
    Num_Byte_Rcve = 0;
    Got_Frame = 1;
    }
    RI_0 = 0;
    }
    if(TI_0)
    {
    // TI_0 = 0;
    }
    }

    Note: If I enable the "TI_0 = 0;" line the program not send any thing to serial port and it seems that the main loop is not run!!

    Thanks a lot

    Farid

  • void USART0_handler(void) interrupt 4 using 3
    {
      unsigned char res;
      int j;
    
      if(RI_0)
      {
        Rcve_Buffer[Num_Byte_Rcve++] = SBUF0;
        if (Num_Byte_Rcve > 200)
        {
          Num_Byte_Rcve = 0;
          Got_Frame = 1;
        }
      RI_0 = 0;
      }
      if(TI_0)
      {
    // TI_0 = 0;
      }
    }

    what are these? unsigned char res; int j; is the above incomplete? "Using 3" does any other interrupt use 3? if yes, is it the same priority? Erik

  • Dear Erik,

    Thanks for your messages,
    "res" and "j" are used in complete ISR but I thought that the whole of IST is not required here.

    It seems that using "printf" cause a problem, Thus I solve the problem by using ISR to send data, First I save data in buffer with "sprintf" and then send out them in ISR.

    Thanks

    Hassan

  • "res" and "j" are used in complete ISR but I thought that the whole of IST is not required here.
    If you want me to say whether your ISR is defective, how do you think I can do that without having the whole story

    It seems that using "printf" cause a problem, Thus I solve the problem by using ISR to send data, First I save data in buffer with "sprintf" and then send out them in ISR.
    If printf (WHY, OH WHY is it (and it's relatives) ever used on a '51) somehow tries to do polled serial while you try to do interrupt drivn serial things WILL screw up.

    Erik