I have this code:
typedef union { uint i; uchar b[2]; } UINT;
UINT ByteToHex(unsigned char b);
I write a little code in assembler that convert a hex byte y two ascii byte.
when I call this routine from C
void main(void){ UINT asc;
asc=ByteToHex(0x49); }
The value returned in asc is not 0x3439. However the value 0x3439 is returned in r6 and r7 correctly.
why?
so what is it, then?
Even if a lot of compilers can transfer small structures in registers, the use of structures (instead of pointers to structures) as parameters or return values is something that is best to avoid.
View all questions in Keil forum