Keil™, An ARM® Company

Cx51 User's Guide

Function Return Values

Function return values are always passed using MCU registers. The following table lists the possible return types and the registers used for each.

Return TypeRegisterDescription
bitCarry FlagSingle bit returned in the carry flag.
char,
unsigned char,
1-byte pointer
R7Single byte type returned in R7.
int,
unsigned int,
2-byte ptr
R6 & R7MSB in R6, LSB in R7.
long,
unsigned long
R4-R7MSB in R4, LSB in R7.
floatR4-R732-Bit IEEE format.
generic pointerR1-R3Memory type in R3, MSB R2, LSB R1.