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
  • The 8051 has a lot of special registers. Each of these has a name: R0 for register 0, A for accumulator, B for the B-register, and C for the carry flag.

    When you display or watch the variable c, you are actually watching the carry flag. To watch your variables that have the same name as 8051 registers, you must escape them with a back-quote ('). For example: 'c

    Could this be the problem behind c never changing?

    Jon

Reply
  • The 8051 has a lot of special registers. Each of these has a name: R0 for register 0, A for accumulator, B for the B-register, and C for the carry flag.

    When you display or watch the variable c, you are actually watching the carry flag. To watch your variables that have the same name as 8051 registers, you must escape them with a back-quote ('). For example: 'c

    Could this be the problem behind c never changing?

    Jon

Children