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
"Now here the t32 is a macro definition" So it's not a variable! You need to #define it in a 'C' header file; then both C51 & A51 can share the header file. See the Manuals, and do a Search here - we've been through it all very recently!
No when i went through the keil's assemblers user's guide the EQU & SET are refered as macro definers As you can see
MOV A,t32
Andy i tried posting the same message on 8052 as you were logged in the main problem is the program is approved by the departments and attached in ISO documents so i cannot change the source code addresses. regards sachin
the EQU & SET are refered as macro definers Where ever did you get that idea? I just checked to be sure, and they're not. They're documented as symbol definitions. A symbol is a rather completely different thing than a macro. I'm not aware of any method that would let compiled C code access symbols that don't follow the C compiler's symbol naming conventions as described in the C51 manual. To interface asm to C51 code, the assembly code has to be adapted. Since you say you can't do that, odds are you're stuck solid. It looks like you're in well over your head here. I suggest you request help from your colleagues immediately.
"To interface asm to C51 code, the assembly code has to be adapted. Since you say you can't do that, odds are you're stuck solid." You could always write a little Assembler function to allow 'C' access to your incompatible, immutable code?
The only problem this is the only copy of code i have. There isn't anybody who even know what and how it is writen. If you want you can see the files posted at http://www.8052.com/user/ssachin/firstasm.a51 http://www.8052.com/user/ssachin/keyboard1.c I have tried to comment kbrd: which is a keyboard function in firstasm.a51 file But one thing can help me if any body tell me how to declear a variable in assembly at a perticular location (eg. t32 at 0x52) which can be accessed by my C function. As right now i am returning a value (R7 stores my return value) and then in assembly using that returned value (R7) to put in t32
MOV t32,R7
small mistake http://www.8052.com/user/ssachin191/firstasm.a51 http://www.8052.com/user/ssachin191/keyboard1.c thanks sachin
View all questions in Keil forum