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

[复制链接]
411|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

粉丝
快速回复 在线客服 返回列表 返回顶部