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 am writing a small C function which is suppose to replace the assembly function My rest code is written in assembly and the assembler (asm51) is used The data declaration is done as
t33 EQU 53H t34 EQU 54H t35 EQU 55H t36 EQU 56H t46 EQU 0A7H
MOV A,t32 CJNE A, #1FH,Chk
t32 DATA 52H t33 DATA 53H t34 DATA 54H t46 DATA 0A7H
extern unsigned char t32;
MOV R0,#t46
"This is the real thing i want to do, I mean, I want to write the result of my C function in a variable located at (0x52)" No, you do not want to do that! You already have the variable in assembler; you want to be sure that 'C' is writing to the same place as your assembler. Therefore you should just use variable name. Otherwise, you will have to remember to update the 'C' if the assembler ever changes. That is a really bad idea! http://www.8052.com/forum/read.phtml?id=60929
It's not clear to me that there is a requirement to locate the variable at an absolute location. If not, you might be interested in the "Memory Initialization" and "Reserving Memory" section of the assembler manual with DB / DS. Did you use the PUBLIC declaration to export the DATA symbol so the linker can find it? E.g., PUBLIC t32 You can then use the C statement extern U8 t32; to access the variable from C. Note that you cannot export EQUates; those are not actually symbols in the object file, but more like a #define macro.
Thanks every body for your help I did following changes and it is worknin fine. Declearation: -
t32 DATA 0x52 PUBLIC t32
extern unsigned char t32; //used t32 for storing the answer // of C function