QC过河记:
#include"sys.h"#include"delay.h"#include"usart.h"#include"timer.h"#include"led.h"#include"fdc2214.h"#include"McuDataSend.h"#include"1602_iic_sw.h"#include"moniiic.h"#include"keybroad.h"#include"beep.h"voidSys_Init(void);floatres0,res1,res2,res3;floattemp0,temp1,temp2,temp3;intmain(void){ BEEP_Init(); Sys_Init(); init_1602(); while(1) {//Oled_Printf_Float(0,1,res0-temp0,0);//Oled_Printf_Float(0,3,res1-temp1,0);//Oled_Printf_Float(0,5,res2-temp2,0);//Oled_Printf_Float(0,7,res3-temp3,0); //printf("CH0;%3.3fCH1;%3.3fCH2;%3.3fCH3;%3.3f\r\n",res0-temp0,res1-temp1,res2-temp2,res3-temp3); printf("CH0;%3.3f\r\n",res0);//printf("CH0;%3.3fCH1;%3.3fCH2;%3.3f\r\n",res0-temp0,res0,temp0);//setCursor(3,0);//ShowxNum(4); while(USART_GetFlagStatus(USART1,USART_FLAG_TC)==RESET);//delay_ms(20);}}u8set=0;/*intmain(void){ u8x,y;BEEP_Init(); Sys_Init();init_1602();while(1){x=KEYPAD_Scan();if((x==16)&&(set==0)) { setCursor(6,0); lcdPrint("WELCOME!"); lcdPrint(" 1autocorrect"); setCursor(1,1); lcdPrint("PLEASESELECTMODE");lcdPrint("2measurepapers"); }if((x==15)&&(set==1)){Clear(); setCursor(6,0); lcdPrint("WELCOME!"); lcdPrint(" 1autocorrect"); setCursor(1,1); lcdPrint("PLEASESELECTMODE");lcdPrint("2measurepapers");delay_ms(10); set=0; }if((x==0)&&(set==0)){ Clear(); delay_ms(1); setCursor(0,0); lcdPrint("1autocorrect"); setCursor(0,1); lcdPrint("30papers:"); //写显示数值 delay_ms(10);set++;}elseif((x==1)&&(set==0)){ Clear(); delay_ms(1); setCursor(0,0); lcdPrint("2measurepapers"); //显示数值 delay_ms(10);set++;} }}*/voidSys_Init(void){ delay_init(); //延时函数初始化 NVIC_Configuration();//设置NVIC中断分组2:2;2位抢占优先级,2位响应优先级 uart_init(115200);//串口初始化为115200while(FDC2214_Init()); delay_ms(100);temp0=232021045.248/Cap_Calculate(0);//读取初始值TIM5_Ctrl_Init(2000-1,720-1);}//定时器5中断服务程序voidTIM5_IRQHandler(void) //TIM5中断{if(TIM5->SR&0X0001)//20ms定时中断 {res0=Cap_Calculate(0);//采集数据//Data_Send_Status(res,0,0);//printf("%5d:%5d:%5d\r\n",res0,res1,res2);led=~led; } TIM5->SR&=~(1