【MSP430】PM2.5浓度测量
来源:互联网 发布:mysql输入中文显示问号 编辑:程序博客网 时间:2024/05/17 08:22
#include "PM2_5.h"void delay(int i);void calculateA();void calculateB();double timeA,timeB,occupancyA,occupancyB;int concA,concB;//----------------得到浓度数据----------------------------void getPM2_5(){ TimerAopen(); TimerBopen(); while(1){ if(secB>=10 || secA>=10){ //设定时间后需要改变 secB=0; secA=0; break; } } return;}//----------------发送浓度数据----------------------------void sendPM2_5(){ int tempA[4]; int tempB[4]; calculateA(); //计算占空比与浓度 calculateB(); //---------------------------- /* int temp2[10]; for(int i=0;i<10;i++){ temp2[i]=(int)width%10; width=width/10; } for(int j=9;j>=0;j--){ Uart1_PutByte(temp2[j]+48); } */ //---------------------------- for(int i=10000;i>0;i--); for(int i=10000;i>0;i--); for(int i=10000;i>0;i--); for(int i=10000;i>0;i--); //发送数据 for(int i=0;i<4;i++){ tempA[i]=(int)concA%10; concA=concA/10; tempB[i]=(int)concB%10; concB=concB/10; } for(int j=3;j>=0;j--){ Uart1_PutByte(tempA[j]+48); } //Uart1_PutByte('\t'); for(int j=3;j>=0;j--){ Uart1_PutByte(tempB[j]+48); } //Uart1_PutByte('\n'); widthA=0; widthB=0; }void delay(int i){ for(int x=i;x>0;x--) for(int j=110;j>0;j--);}void calculateA(){ timeA=widthA*0.000001; occupancyA=timeA*(1.0/10.0)*100; //设定时间后需要改变 //转换为浓度 concA=(int)(occupancyA*20);}void calculateB(){ timeB=widthB*0.000001; occupancyB=timeB*(1.0/10.0)*100; //设定时间后需要改变 //转换为浓度 concB=(int)(occupancyB*20);}
0 0
- 【MSP430】PM2.5浓度测量
- PM2.5测量&PMS5003粉尘传感器使用(附程序)
- MSP430 测量输入电平
- 【例程】MSP430测量频率程序
- 如何测量MSP430的功耗?
- 如何测量MSP430的功耗?
- 如何应对pm2.5
- 全球PM2.5分布图
- HDU5182 PM2.5
- hdu 5182 PM2.5
- 【HDOJ】5182 ( PM2.5 )
- hdu 5182 PM2.5
- hdu 5182 PM2.5
- PM2.5传感器
- ML2016-PM2.5 Prediction
- PM2.5检测
- pm2
- pm2
- 109. Convert Sorted List to Binary Search Tree
- 排它平方数
- 110. Balanced Binary Tree
- 【MSP430】clk.c
- 二叉树红黑树(未完)
- 【MSP430】PM2.5浓度测量
- 1st round, 283 moveZeroes
- xss (跨站脚本攻击)教程
- Leetcode 202. Happy Number
- xss(跨站脚本攻击)教程
- 2016年总结:教师路的开启,爱情味的初尝 (下)
- 111. Minimum Depth of Binary Tree
- 1st round, 325 maxSubArrayLen
- 浅谈CSRF攻击方式