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 mismatch?

I have two simple code examples:

; Example 1
ORG 0
MOV A,#0xff
MOV P0,A
TOP: MOV P1,P0
SJMP TOP
END

----------------------

; Example 2
ORG 0
TOP: MOV A,#0xff
MOV P0,A
MOV P1,P0
SJMP TOP
END

----------------------

Both examples attempt to do the same thing. When clicking on pins of P0 the value is sent to P1. When I single step (F11) through the programs the perform in an identical manner. When I run the programs (F5), example 2 ends up with a mismatch between P0 pins and P1 values.

What could cause such a mismatch?

Parents Reply Children
  • I just tried your example...

    CSEG    AT      0
    
    TOP:    MOV     A,#0xff
            MOV     P0,A
            MOV     P1,P0
            SJMP    TOP
    END

    However, I used CSEG instead of ORG. ORG 0 does not always locate a segment at physical address 0. Nonetheless, that wouldn't cause the problems you are seeing.

    Anyway, under simulation using the Generic I couldn't get it to fail. It works perfectly.

    1. What version of uVision2 and the DP51.DLL do you have?

    2. What PC system do you have...CPU speed, RAM, OS, etc?

    3. Can anyone else try this and get it to fail?

    Jon

  • 1. The uVision2 version and DP51.DLL are both 2.38

    2. At home I'm using:
    * Intel Pentium II 450
    * 196 MB Ram
    * Win98 SE

    Same problem happened at work on a new Dell system (sorry, don't have exact specs) running NT and in the lab on new Gateway systems. I've seen it happen on every PC I've tried-- about 18 so far.

    3. Don't know about here, but this was seen by many students (~30) in my microprocessors lab (I teach at a local University). Each student wrote their code a little differently yet all got the same results. I didn't have an explanation for them as to why the mismatch was occuring.

  • Same problem happened at work on a new Dell system (sorry, don't have exact specs) running NT and in the lab on new Gateway systems. I've seen it happen on every PC I've tried-- about 18 so far.

    Hmmm. I've tried this on 3 machines and they all work correctly. So, maybe we have a mismatch in how we're testing this.

    How exactly do you set the pins of P0 during simulation?

    Here's what I do.

    1. In uVision2 - Project Options - Debug, make sure Use Simulator is selected.

    2. Click Start/Stop Debug Session on the Toolbar.

    3. Open the Port 0 and Port 1 dialogs from the Peripherals menu.

    4. Make sure Periodic Window Update (from the View menu) is checked.

    5. Click RUN.

    6. Click on any of the Pins checkboxes in the Parallel Port 0 dialog (not on the P0 checkboxes)). The corresponding pin and bit in P1 changes to match.

    No amount of clicking or double-clicking or seems to cause any problems.

    I am using the latest release (V7.07a) which includes uVision2 V2.40 and DP51 DLL Version 2.40. I also tried this with an older version 2.36 and everything worked OK there, too.

    Jon

  • I'm following the same steps as you are yet I still can get a mismatch.

    I did, however, just notice something interesting... the mismatch appears to be with the displayed pins check boxes and not with the pins value. For example, all the P0 pins are checked but the value indicates 0xBF and P1 has a value of 0xBF with the bit D6 cleared. I grabbed a screen shot of this but I'm not sure how to post it.