csmyldl 發表于 2023-11-19 16:40
adcresult_0= (adc_result/100)%100;
adcresult_1= (adc_result/10)%10;
adcresult_2= adc_result%10; ...
csmyldl 發表于 2023-11-19 16:40
adcresult_0= (adc_result/100)%100;
adcresult_1= (adc_result/10)%10;
adcresult_2= adc_result%10; ...
人中狼 發表于 2023-11-19 17:13
搞清除法的結果是什么,搞清取余的結果是什么,搞清要的是哪一位數字,板凳的錯了其中一行代碼
人中狼 發表于 2023-11-19 17:13
搞清除法的結果是什么,搞清取余的結果是什么,搞清要的是哪一位數字,板凳的錯了其中一行代碼
samxon 發表于 2023-11-19 17:34
真的沒發現錯誤,我用excel模擬計算沒有錯誤
Hephaestus 發表于 2023-11-19 17:42
把我在沙發的發言讀100遍。
Hephaestus 發表于 2023-11-19 17:42
把我在沙發的發言讀100遍。
君工創 發表于 2023-11-19 17:58
被門檻石絆腳了,只要你看出問題了,就是一大進步。
samxon 發表于 2023-11-19 17:57
老師,已看101遍,還是發現不了問題。第三位始終顯示0
adc_result = 12.76543;
Hephaestus 發表于 2023-11-19 16:48
這三行你寫錯了,樓主是對的。
Hephaestus 發表于 2023-11-19 18:49
你們居然都看不懂我在沙發的發言,我在說清楚一些
根據:uchar adc_result;
samxon 發表于 2023-11-19 20:06
如果變成3了,為什么第二位又顯示正常呢
samxon 發表于 2023-11-19 21:06
#define uint unsigned int
#define uchar unsigned char
uint adc_result;
Hephaestus 發表于 2023-11-19 21:14
uint adc_result;
adc_result=12.5
samxon 發表于 2023-11-19 21:24
float adc_result;
adc_result = 12.5
samxon 發表于 2023-11-19 17:30
懷疑是不是ADC沒有傳小數位過來
zhuls 發表于 2023-11-19 21:40
如果:
uchar adc_result; //那么后面的“adc_result = 771;"這個就不對了,除非你的uchar 不是 “u ...
Hephaestus 發表于 2023-11-19 21:36
還是不對,float不能用/(整除)和%兩個運算。
Hephaestus 發表于 2023-11-19 22:15
你以為寫成char或者unsigned char就是8位了?naive!我用過char是16位的編譯器,你見識太少。
zhuls 發表于 2023-11-20 08:49
你用的16位的是什么編譯器?說出來讓我見識一下。
csmyldl 發表于 2023-11-20 14:16
uchar adc_result;
adc_result = 771;
adc_result的取值范圍只能是0-255,adc_result = 771;后,默認adc ...
Hephaestus 發表于 2023-11-20 13:51
你去ti官網找spru514z這份文檔看看。
zhuls 發表于 2023-11-20 17:05
學習了~
然而,文檔中所說的中wide character(w_char) ,并不是character(char),不是同一回 ...
Hephaestus 發表于 2023-11-20 18:45
這是基本數據類型,跟wchar有個蛋關系???
wchar是字符串才要有的,用于區分ASCII與UTF-8 Unico ...
Hephaestus 發表于 2023-11-19 16:33
uchar adc_result;
adc_result = 771;
mtt661 發表于 2023-11-21 12:13
確實要反復看,771-若干個256后,就是3 uchar改uint
歡迎光臨 (http://m.zg4o1577.cn/bbs/) | Powered by Discuz! X3.1 |