STM8 IAR中函数返回值不正常 40
二分法查表法求电阻,跟进到函数时返回都对,但是函数出来就不对了。floatTemp(u16adc){u32reg;u16temp;floattempD;if(adc!=0...
二分法查表法求电阻,跟进到函数时返回都对,但是函数出来就不对了。float Temp(u16 adc) { u32 reg; u16 temp;float tempD; if(adc!=0) { reg=AdcToReg(adc)/10; if(reg>=ntcUp[0]) { temp=Reg_Find_Down(reg); tempD=((float)reg-ntcDown[temp])/(ntcDown[temp+1]-ntcDown[temp]); tempD= (temp+tempD); return tempD; }else { temp=Reg_Find_Up(reg); tempD=(ntcUp[temp] -reg)/(ntcUp[temp]-ntcUp[temp+1]) ; temp=temp+tempD; return temp; } }else { return 0.0 ; } }
展开
1个回答
2016-06-27
展开全部
include#include#defineMAX100structaddr{charname[30];charstreet[40];charcity[20];charstate[3];unsignedlongintzip;}addr_list[MAX];voidinit_list(void);intmenu_select(void);voidenter(void);intfind_free(void);voiddeleted(void);voidlist(void);intmain(void){charchoice;init_list();/*initializethestructurearray*/for(;;){choice=menu_select();switch(choice){case1:enter();break;case2:deleted();break;case3:list();break;case4:exit(0);}}return0;}/*initializethelist*/voidinit_list(void){registerintt;for(t=0;t4);returnc;}/*Inputaddressintothelist*/voidenter(void){intslot;chars[80];slot=find_free();if(slot==-1)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询