I'm trying to simulate a simple design (written in assembler), in uVision4, that has a few memory mapped peripherals and uses P2 for GPIO. In "options for target" I set "Off-chip Ddata memory" to: Start: 0x0000 Size: 0x0100 When I run the simulator, external memory access is being done using P2, which causes problems when the value of P2 changes for GPIO. While searching the forum posts I found some mention of P2 addressing being the default for PDATA access, but found nothing about how to disable this for the simulator. Perhaps a parameter passed to S8051? Any ideas or insight would be appreciated.
External memory will be accessed using a fixed value of zero instead of the current value of P2.
This may be a bug that does not make sense. a Simulation SHOULD access external memory with P2 & pO or it would not be a simulation.
in other words, you want the simulator to do what YOU want, not simulate what the CHIP does.
Erik
From the MCU, MOVX opcode documentation:
...
In the first type, the contents of R0 or R1 in the current register bank provide an eight-bit address multiplexed with data on P0. Eight bits are sufficient for external I/O expansion decoding or for a relatively small RAM array. For somewhat larger arrays, port pins can be used to output higher-order address bits. These pins would be controlled by an output instruction preceding the MOVX.
I can assure you that P2 doesn't express the upper 8 bits of the address during MOVX A, @Ri or MOVX @Ri, A for these processors.
The best documentation for the PPAGE parameter is here:
http://www.keil.com/support/docs/2394.htm
And from examining S8051.DLL it seems that this behaviour is implemented. What is not clear is how to actually set this parameter and verify it has been set to the intended value. Without looking at the source code for S8051.DLL or internal Keil documentation, I doubt there is much more that you can add to this conversation that will be useful.
you are right, the P2 bits are part of the address, but if you ignore them with a 256 bit address P2 is unaffected.
I have just never operated with that small an external RAM and thus never thought of it in that way.
so P2 IS part of the address, but not affected, so you cn ignore it if you so desire.
Even old dogs can learn new tricks