duration = T_End - T_Start; lowpulseoccupancy += duration; if((T_End - T_Start) >= sampletime_ms) { ratio = (lowpulseoccupancy/(sampletime_ms*10.0)); concentration = (1.1*pow(ratio,3)-3.8*pow(ratio,2)+520*ratio+0.62); lowpulseoccupancy = 0; T_End = T_Start = 0; Tx_Uart0_String("\r\n"); Tx_Uart0_String("Concentration = "); sprintf(Buf,"%f",concentration); Tx_Uart0_String(Buf); Tx_Uart0_String(" pcs/0.01cf\n\n\n"); GPIO_enableInterrupt(GPIO_PORT_P4,GPIO_PIN3); }
↧