OpenEdv-开源电子网

 找回密码
 立即注册
正点原子全套STM32/Linux/FPGA开发资料,上千讲STM32视频教程免费下载...
查看: 4496|回复: 1

STM32F2XX印出uint64_t的data bit問題

[复制链接]

2

主题

4

帖子

0

精华

新手上路

积分
33
金钱
33
注册时间
2012-7-25
在线时间
0 小时
发表于 2013-7-16 15:58:57 | 显示全部楼层 |阅读模式
各位朋友午安,小弟最近使用STM32F2系列的應用中,打算使用64位元的無號整數
紀錄64根GPIO狀態,但實作時發現輸出結果不如所想的那麼簡單,只有輸出到0~31位元
32位元在移位運算則是一點都沒有成功。不知道大家有無遇到這樣的情況,是否可解
另外小弟環境是使用eclipse+arm的交叉編譯器作開發。
驗證程式碼如下:

    uint64_t test=0x0ull, count;
    for(count=0; count<64; count++){
        test |= ((uint64_t)1<<count);
        printf("test[%d]=0x%016llx\r\n", (unsigned int)count, test);
    }
數出結果:
est[0]=0x0000000000000001
test[1]=0x0000000000000003
test[2]=0x0000000000000007
test[3]=0x000000000000000f
test[4]=0x000000000000001f
test[5]=0x000000000000003f
test[6]=0x000000000000007f
test[7]=0x00000000000000ff
test[8]=0x00000000000001ff
test[9]=0x00000000000003ff
test[10]=0x00000000000007ff
test[11]=0x0000000000000fff
test[12]=0x0000000000001fff
test[13]=0x0000000000003fff
test[14]=0x0000000000007fff
test[15]=0x000000000000ffff
test[16]=0x000000000001ffff
test[17]=0x000000000003ffff
test[18]=0x000000000007ffff
test[19]=0x00000000000fffff
test[20]=0x00000000001fffff
test[21]=0x00000000003fffff
test[22]=0x00000000007fffff
test[23]=0x0000000000ffffff
test[24]=0x0000000001ffffff
test[25]=0x0000000003ffffff
test[26]=0x0000000007ffffff
test[27]=0x000000000fffffff
test[28]=0x000000001fffffff
test[29]=0x000000003fffffff
test[30]=0x000000007fffffff
test[31]=0x00000000ffffffff
test[32]=0x00000000ffffffff
test[33]=0x00000000ffffffff
test[34]=0x00000000ffffffff
test[35]=0x00000000ffffffff
test[36]=0x00000000ffffffff
test[37]=0x00000000ffffffff
test[38]=0x00000000ffffffff
test[39]=0x00000000ffffffff
test[40]=0x00000000ffffffff
test[41]=0x00000000ffffffff
test[42]=0x00000000ffffffff
test[43]=0x00000000ffffffff
test[44]=0x00000000ffffffff
test[45]=0x00000000ffffffff
test[46]=0x00000000ffffffff
test[47]=0x00000000ffffffff
test[48]=0x00000000ffffffff
test[49]=0x00000000ffffffff
test[50]=0x00000000ffffffff
test[51]=0x00000000ffffffff
test[52]=0x00000000ffffffff
test[53]=0x00000000ffffffff
test[54]=0x00000000ffffffff
test[55]=0x00000000ffffffff
test[56]=0x00000000ffffffff
test[57]=0x00000000ffffffff
test[58]=0x00000000ffffffff
test[59]=0x00000000ffffffff
test[60]=0x00000000ffffffff
test[61]=0x00000000ffffffff
test[62]=0x00000000ffffffff
test[63]=0x00000000ffffffff
正点原子逻辑分析仪DL16劲爆上市
回复

使用道具 举报

530

主题

11万

帖子

34

精华

管理员

Rank: 12Rank: 12Rank: 12

积分
165540
金钱
165540
注册时间
2010-12-1
在线时间
2117 小时
发表于 2013-7-16 16:48:18 | 显示全部楼层
回复【楼主位】swordfish_yang:
---------------------------------
这么高级的编译器,没用过啊.呵呵.
我记得用long long就可以定义64位数据.
我是开源电子网www.openedv.com站长,有关站务问题请与我联系。
正点原子STM32开发板购买店铺http://openedv.taobao.com
正点原子官方微信公众平台,点击这里关注“正点原子”
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则



关闭

原子哥极力推荐上一条 /2 下一条

正点原子公众号

QQ|手机版|OpenEdv-开源电子网 ( 粤ICP备12000418号-1 )

GMT+8, 2025-7-17 18:58

Powered by OpenEdv-开源电子网

© 2001-2030 OpenEdv-开源电子网

快速回复 返回顶部 返回列表