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

How to call a C function from assembly

I am writing an ISR using assembly language .
I want to know how to call a C function from assembly.I am using keil compiler and 8051 microcontroller .Reply as soon as possible.

Parents
  • After the above modifications its not giving any syntax error but logical errors i am facing means my code is not working.

    Simply calling the C function is not enough - your assembly code must also follow the calling conventions for C functions, which are described in the link I posted earlier. It deals with things like:

    * How are the function arguments passed to the function ?
    * How is the return value passed back to the caller ?
    * Which registers have to be saved by the caller, and which are saved by the function ?

    and so on.

Reply
  • After the above modifications its not giving any syntax error but logical errors i am facing means my code is not working.

    Simply calling the C function is not enough - your assembly code must also follow the calling conventions for C functions, which are described in the link I posted earlier. It deals with things like:

    * How are the function arguments passed to the function ?
    * How is the return value passed back to the caller ?
    * Which registers have to be saved by the caller, and which are saved by the function ?

    and so on.

Children
No data