c语言 (uint32_t)0x,将浮点值存储在uint32_t指针中(Store float value in uint32_t pointer)

I want to store some float data in the FRAM register of my TI MSP430 microcontroller and have some prolems.

I don't know how I can do this.

With normal integer variables it is no problem.

Normal integer variables:

void main()

{

uint32_t value = 25;

uint32_t framPtr = 0xD000;

FRAMC_write_uint32_t(value, (uint32_t*)framPtr);

}

void FRAMC_write_uint32_t(uint32_t value,

uint32_t *framPtr)

{

*framPtr = value;

}

But with float values it doesn't work. I tried to change the value inside the function to float, but no result.

This is my float data:

float value = 1.25;

uint32_t framPtr = 0xD000;

With this function it doesn't work:

void FRAM_write_float(float value,

uint32_t *framPtr)

{

*framPtr++ = (float)value;

}

It saved the data 1.40129846e-45 (DEN) (HEX: 0x00000001) in my memory bank.

I hope somebody can help me with my problem. Thanks!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值