We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
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?
The displays of Port pins in uV2 may not be updated as fast as you think, while running the simulation untinterrupted. Make sure you check the "Periodic Window Update" option in the "View" menu if you want this kind of synchronicity.
Even if it didn't update as fast as I'd like, I would think it would eventually catch up to what the values should be. The mismatch is persistent in that once it is out of sync it stays that way. and yes-- periodic update is enabled.
When I run the programs (F5), example 2 ends up with a mismatch between P0 pins and P1 values. Hmmm. That's not what happens when I run it. Here's what I get. When I start...
P0 = XXXX XXXX P0 Pins = XXXX XXXX P1 = XXXX XXXX P1 Pins = XXXX XXXX
P0 = XXXX XXXX P0 Pins = XXXX _XXX P1 = XXXX _XXX P1 Pins = XXXX _XXX
Hmmm...? Keep clicking on P0 pins. Seems like the more I click the more of a chance to get out of sync. I'm using Generic 8051.
I just tried your example...
CSEG AT 0 TOP: MOV A,#0xff MOV P0,A MOV P1,P0 SJMP TOP END
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.