hi,
I have asked a question about the CCS memory browser.
https://e2e.ti.com/support/microcontrollers/c2000/f/171/t/411698
But I found it should be a question about difference between function pointer and variable pointer.
In TI's examples, the slope of temperature sensor is gotten by a function pointer as shown below:
//the address is 0x3D7E82
#define getTempSlope() (*(int (*)(void))0x3D7E82)()
return ((sensorSample - getTempOffset())*(int32)getTempSlope() + FP_ROUND + KELVIN_OFF)/FP_SCALE - KELVIN;
I use a variable pointer to get the data as shown below:
//the address is 0x3D7E83
int *getTempSlope = (int*)0x3D7E83;
slope = *getTempSlope;
They can get the same slope. But be careful that they use different addresses.
Tommy told me there is something about the op-codes but I really don't know the reasons.
I am looking forward to your reply.
best regards.
Di