Keil Logo

Parameters and Registers

The Cx51 Compiler passes up to three function arguments in MCU registers. This mechanism significantly improves system performance as arguments are not written to and read from memory. Argument or parameter passing can be controlled by the REGPARMS and NOREGPARMS directives.

The following table details the registers used for different argument positions and data types.

1-byte ptr
2-byte ptr
generic ptr
1 R7 R6 & R7 R4-R7 R1-R3
2 R5 R4 & R5 R4-R7 R1-R3
3 R3 R2 & R3   R1-R3


  • If the first parameter of a function is a bit type, then other parameters are not passed in registers. This is because parameters that are passed in registers are out of sequence with the numbering scheme shown above. For this reason, bit parameters should be declared at the end of the argument list.
  • If no registers are available for argument passing, fixed memory locations are used for function parameters.

Related Knowledgebase Articles

  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.