Keil Logo

C51: Inline Assembly


Information in this article applies to:

  • C51 All Versions

QUESTION

I'm currently working on an interrupt service routine that has a challenging timing requirement. After compiling the routine and looking at the assembly listing I noticed that the compiler chose a different CJNE instruction than I would have.

I was wondering if there was an easy way to modify the assembled code by changing a few of the assembly lines without having to re-write the whole routine in assembly?

ANSWER

You can write your code in C, then use the SRC directive to have the compiler generate an assembly module for your C code. You may modify the generated assembly file and include that in your project. Note that once you modify this file, you should not regenerate it with the C file because that would overwrite your changes.

MORE INFORMATION

  • Refer to SRC in the Cx51 User's Guide.
  • Refer to CJNE in the 8051 Instruction Set Manual.

Last Reviewed: Thursday, February 25, 2021


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.