如何使用Keil仿真环境查看CPU类型字长?【worldsing笔记】
筆者上次寫了如何用IAR查CPU的字長和數據類長度的方法:點擊這里查看
今天試著在Keil MDK 5.0 里查看CPU的字長和數據類長度,打開一個已有的工程,編譯并進入Debug,如圖1.1所示:
?
???????????????????????????????????????????? 圖1.1 Keil 進入Debug仿真
?
打開Watch窗口,View->Watch Windows->Watch 1,點擊<Enter expression>并輸入sizeof(int),如圖1.2所示,但是發現Value欄無法顯示出來,不管是輸入是sizeof(int)還是sizeof(char) 最后的Type欄都顯示uchar
??????????????????????????????????????? 圖1.2 Watch 查看變量
?
看來只能用代碼來測試了,同樣的方法將定義的類型變量長度放到Watch窗口來看,圖1.3所示
char CharTypeLen?? = sizeof(char); 
???? char uCharTypeLen? = sizeof(unsigned char); 
???? char ShortTypeLen? = sizeof(short); 
???? char uShortTypeLen = sizeof(unsigned short); 
???? char IntTypeLen??? = sizeof(int); 
???? char uIntTypeLen?? = sizeof(unsigned int); 
???? char LongTypeLen?? = sizeof( long); 
???? char uLongTypeLen? = sizeof(unsigned long); 
???? char lLongTypeLen? = sizeof(long long); 
???? char FloatTyepLen? = sizeof(float); 
???? char DoubleTypeLen = sizeof(double); 
???????????????????????????????????????????????????? 圖1.3 代碼測法
?
?
?
?
?
?
?
?
轉載于:https://www.cnblogs.com/worldsing/p/3454774.html
總結
以上是生活随笔為你收集整理的如何使用Keil仿真环境查看CPU类型字长?【worldsing笔记】的全部內容,希望文章能夠幫你解決所遇到的問題。
                            
                        - 上一篇: CPU卡
 - 下一篇: ASP.Net 页面和后台执行的先后顺序