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

Debug problem

I am using the simulator of the uvision2.
According to the debugger the value of c doesn't change (I am using the serial peripheral) and the debugger never execute the Start_bit = 1; even though the SBUF = 0x46.

char c ;
void SerialPort(void) interrupt 4 using 2
{
      if (RI == 1) {
        c = SBUF;
      if(SBUF==0x46)
        Start_bit = 1;

      RI = 0;
  }
}

Thank you very much

Parents
  • This is the extention of the first interrupt function, but steel according to the simulator debugger ArrLen and chr stay with their init values after the assignment
    ArrLen = SBUF;

    void SerialPort(void) interrupt 4 using 2
    {
    if (RI == 1)
    {
    if(ArrLenFlag==0) // The first value.
    {
    ArrLen = SBUF;
    ArrLenFlag = 1;
    }
    else
    {
    if(SBUF=='S') // The start char.
    {
    Start_bit = 1;
    SaveData(1000);
    SaveData(1000);
    }
    else
    {
    chr = SBUF;
    SaveData(chr) // Save the data.
    }
    }
    RI = 0;
    }
    }

    Thank for your help

    Kobi

Reply
  • This is the extention of the first interrupt function, but steel according to the simulator debugger ArrLen and chr stay with their init values after the assignment
    ArrLen = SBUF;

    void SerialPort(void) interrupt 4 using 2
    {
    if (RI == 1)
    {
    if(ArrLenFlag==0) // The first value.
    {
    ArrLen = SBUF;
    ArrLenFlag = 1;
    }
    else
    {
    if(SBUF=='S') // The start char.
    {
    Start_bit = 1;
    SaveData(1000);
    SaveData(1000);
    }
    else
    {
    chr = SBUF;
    SaveData(chr) // Save the data.
    }
    }
    RI = 0;
    }
    }

    Thank for your help

    Kobi

Children