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

I/O Port simulation

I monitering my I/O port from Peripherials -> I/O-ports -> Port 0

But the value of P0 and Pins are always diferrent
That is very strange..

I use P0 as an LCD data bus.
I set the value of P0, When I want to display a character on LCD.

but Pins bits can't reflect the value of P0

So my LCD display can't work normally.

Does any one known what happens?

thank you..

Parents
  • The problem you are having is caused NOT by a bug but by the accurate simulation of P0.

    If you take a look at the 8051 data sheet, you'll find that P0 requires external pull-up resistors if you intend on using it as an I/O port. Port 1, 2, and 3 do not (they have internal pull-ups).

    The uVision2 simulator accurately simulates this.

    You can add simulation for external pull-ups by writing a short signal function. For example:

    signal void pullup_p0 (void) {
    while (1) {
      wwatch (D:0x80);
      PORT0 = P0;
      }
    }
    
    pullup_p0 ();

    Whenever your program writes anything to P0, it gets copies to the PORT0 output pins.

    Jon

Reply
  • The problem you are having is caused NOT by a bug but by the accurate simulation of P0.

    If you take a look at the 8051 data sheet, you'll find that P0 requires external pull-up resistors if you intend on using it as an I/O port. Port 1, 2, and 3 do not (they have internal pull-ups).

    The uVision2 simulator accurately simulates this.

    You can add simulation for external pull-ups by writing a short signal function. For example:

    signal void pullup_p0 (void) {
    while (1) {
      wwatch (D:0x80);
      PORT0 = P0;
      }
    }
    
    pullup_p0 ();

    Whenever your program writes anything to P0, it gets copies to the PORT0 output pins.

    Jon

Children