MCU stuck when convert point to double
There is a array:
uint8_t dat[8] = {0xcd, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x5e, 0x40};
It means a double variable data in memery. The value is 123.45.
This code can be run in my computer:
int main(int argc, char *argv[])
{
uint8_t dat[] = {0xcd, 0xcc, 0xcc, 0xcc, 0xcc, 0xdc, 0x5e, 0x40};
double test = *((double*)dat);
printf("%.3f\r\n", test);
return 0;
}
It will put: 123.450
But on stm32f103rct6. It will stuck when I run this:
double test = *((double*)dat);
But use float will not stuck:
float test = *((float*)dat);
So, how can I convert memery to double rightly on stm32f103? (I use stm32cubeide)
Thanks!