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:"); //寫顯示數(shù)值 delay_ms(10);set++;}elseif((x==1)&&(set==0)){ Clear(); delay_ms(1); setCursor(0,0); lcdPrint("2measurepapers"); //顯示數(shù)值 delay_ms(10);set++;} }}*/voidSys_Init(void){ delay_init(); //延時(shí)函數(shù)初始化 NVIC_Configuration();//設(shè)置NVIC中斷分組2:2;2位搶占優(yōu)先級(jí),2位響應(yīng)優(yōu)先級(jí) uart_init(115200);//串口初始化為115200while(FDC2214_Init()); delay_ms(100);temp0=232021045.248/Cap_Calculate(0);//讀取初始值TIM5_Ctrl_Init(2000-1,720-1);}//定時(shí)器5中斷服務(wù)程序voidTIM5_IRQHandler(void) //TIM5中斷{if(TIM5->SR&0X0001)//20ms定時(shí)中斷 {res0=Cap_Calculate(0);//采集數(shù)據(jù)//Data_Send_Status(res,0,0);//printf("%5d:%5d:%5d\r\n",res0,res1,res2);led=~led; } TIM5->SR&=~(1