I have a HCS08SG32 and want to do the following (environment: Codewarrior 6.3, hardware: demo board DEMO9S08SH32/SG32) :
call of function:
i2c_read (0x20, 0x30, 2, send);
I discoverd an error, because inside the function i2c_read() the values of the parameters are not equal to the call of the function.
where send is defined:
unsigned char send;
i2c_read is defined as:
unsigned char i2c_read (unsigned char devaddr, unsigned char addr, unsigned char len, unsigned char *data);
When I step by the debugger into the function, the parameters are pushed at the stack as 16 bits values (see attached file), but are popped as 8 bit values. As a result: the parameters inside the function are cut and have not the values like in the call (devaddr = 2, addr=0, len =0) .
If I change the datatype of the parameters to a 16 Bit value, it works.
But I want to understand, why 8 Bit parameters are pushed to stack as 16 Bit Values and wrongly popped inside the function as 8 bit.
I already went trough the compiler options, but did not find a setting to influence this.
I hope, somebody can remove the tomatos from my eyes?
Many thanks in advance