C251 User's Guide

Function Return Values

MCU registers pass function return values. The following table lists the return types and the registers used for each.

Return TypeRegisterDescription
bitCarry FlagSingle bit returned in the carry flag
char/unsigned char,
1-byte pointer
R11Single byte type returned in R11
int, unsigned int,
2-byte pointer
WR6MSB in R6, LSB in R7.
long, unsigned longDR4MSB in R4, LSB in R7
floatDR432-Bit IEEE format: 'exponent' and 'sign' in WR4
doubleDR0, DR464-Bit IEEE format: 'exponent' and 'sign' in WR0
4-byte pointerDR0MSB in R0, LSB in R3.

For parameter passing to C51 functions; 3 byte pointers are returned in the registers R1/R2/R3. Refer to PARM51 or PARM251 for more information.