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