Mixing Assembler and PIC C (Help!)

Status
Not open for further replies.

biker12

New Member
Hi, i'm having some problems with a project, I need to call some C functions from assembler code and vice-versa. I have been able to call a assembler code from a C code but I can not do the inverse. Someone can tell me how to call a C function from a assembler code? I need to know some things like if the C code must have a main() or if I must save the C code with a different extention of .c

Thanks.

PDT: I'm using the C18 Compiler.
 
You generally can't invoke C code from within ASM without advanced knowledge of the compiler/linker. Otherwise the only thing you can do is selectivly compile the code you want, dis assemble it and try to make sense of it. It'd be easier to completely re-write the C code in ASM.
 
Last edited:

can't you place assembly code with in __asm tags inside of c?
 

Hi, thanks for reply. The problem I have with what you said is that the C code and the assembler code are too large and complex and it is imposible to translate them now. I have been looking for some information and I found the C18 User's Guide in wich explains (in the section 3) that it is posible to do, but they didn't say how to compile the C code and if it is necesary to create a library file or something like that.

Thanks.
 
can't you place assembly code with in __asm tags inside of c?

No I can't, that method is better for a litte block of code and also I want to call a C function from an assembler code, I have already done the inverse that is what you said.

Thanks anyway.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…