Hi Everyone Have any C51 of instructs application like assembler code? PUSH DPL PUSH DPH . . . . POP DPH POP DPL
You have posted identifying ARM as the product. Are you asking whether the ARM has instructions that are functionally equivalent to the 8051's PUSH and POP instructions? If so, then yes it does.
Sorry! my product is C51 tools.
Hsu, When you are writing in C, you must give up the ability to use the registers directly as you can't be sure of their values since the compiler is using them. You can certainly code up your own "stack" functions in C with a push() and pop(), but using them to do anything with DPTR will not be useful.
I am using C51 to control external memory(ESPON's IC), then I will show data(a picture)via drive IC to diplay on Panel.So, I have to control two IC at the same time. Therefore, I have to keep drive IC data to keep off ESPON memory data have covered. ;------------- . . . MOVC A,@A+DPTR; INC DPTR . . . ;-------- PUSH DPL PUSH DPH MOV DPL,R1; MOV DPL,R2 CLR P3.4; CLR P3.1; CLR P3.0; CLR P1.0; MOVX @DPTR,A; SETB P3.4; POP DPH; POP DPL; RET ;---------
Therefore, I have to keep off ESPON memory data have covered.
The thing is, if you write your code entirely in 'C' you will never know, or need to know what the contents of DPTR or any other 'general purpose' registers actually are. The compiler will save and restore any registers it needs to. The only registers you need to concern yourself with are SFRs which control peripherals such as the timers. A large part of the reason for using 'C' rather than assembler is to achieve this pleasant level of abstraction. I the code you posted you are saving DPTR, writing to somewhere in the xdata memory space then restoring DPTR. In 'C' all this would be handled by the compiler. To write to a specific xdata address you could use something like: XBYTE[0x8000]=0xff; See the macros in absacc.h.