打印

写入EEPROM的为什么会是负数呢?请教

[复制链接]
153|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
没名字的人|  楼主 | 2019-11-24 16:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
定义      uint32_t temp0;

写入:
temp0=2109000000ll;
                temp[0] = temp0/16777126;
                temp[1] = temp0%16777126/65536;
                temp[2] = temp0%16777126%65536/256;
                temp[3] = temp0%16777126%65536%256;
               
                I2C_EE_BufferWrite(temp, 0x00, 4);


读出
        I2C_EE_BufferRead(temp, 0x00, 4);
        temp0=temp[0]*16777126+temp[1]*65536+temp[2]*256+temp[3];


打印输出
     printf("%ld\n",temp0);

如果temp=2200000000的话,打印输出的结果就是负数,无符号32位最大不是4294967295吗,请前辈们指点一二。

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

420

主题

432

帖子

0

粉丝