This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Assembly variables form C

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
Now here the t32 is a macro definition
(if I am not wrong as I have never used assembly but do have knowledge of it since it was there in the curriculum)

and it is referred as variable in the assembly program as
    MOV     A,t32
    CJNE    A, #1FH,Chk

and I want to access the same t32 from my C function

I tried defining the variables as
t32       	DATA     52H
t33       	DATA     53H
t34       	DATA     54H
t46       	DATA     0A7H

But it does not give me the access in C if I wrote
extern unsigned char t32;

The addressing of the variables at that particular location cannot be changed as some places the address is used as
MOV     R0,#t46

I have only two days to complete the program
and I have finished my C function and it is working fine but
I am not able to patch it at old assembly function


Please help
sachin

Parents
  • 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.

Reply
  • 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.

Children