Hi all, I know when to use AREGS/NOAREGS and using directive. In my project, I am using AREGS (that is default). After compiling, when I look at *lst files,I realize some functions, after being converted to assemble language, using register R0-R7, while some using absolute register AR0-AR7. Does anyone know at what circumstance, complier will use absolute AR0-AR7 and when use R0-R7 while AREGS is enabled ? Thanks Daniel
>>It depends on the instructions required to >>code your program. >>For example: >>PUSH ARx <- since there is no PUSH Rx >>MOV Rx,ARy <- since there is no MOV Rx,Ry" I am not with it, my code is written by C, Can you please tell a bit more ? Thanks
"my code is written by C" Your Source code is written in 'C' - but the chip doesn't understand 'C'. That's why you need a Compiler: the compiler converts your 'C' Source code into Object code - which is a representation of the binary instructions that the processor actually does understand. Obviously, the 'C' compiler can only use instructions in the Object code that the processor will understand. So, if the Compiler chooses to use instructions like the ones Reinhard has listed, you will get absolute register references in your generated object files! You can find the full 8051 Instruction Set in Chapter 2 of the so-called "bible" for the 8051: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf For future reference, the complete set of chapters is: Chapter 1 - 80C51 Family Architecture: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf Chapter 2 - 80C51 Family Programmer's Guide and Instruction Set: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf Chapter 3 - 80C51 Family Hardware Description: http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf