#include "Timer.h"
#include "Key.h"
#include "Init.h"
#include "Led.h"
#include "Smg.h"
#include <stdio.h>
#include "iic.h"
#include "onewire.h"
//函数声明
void Key_Proc();
void Led_Proc();
void Smg_Proc();
void DAC_Proc();
//显示刷新变量
unsigned char Key_Slow;
unsigned char Led_Slow;
unsigned int Smg_Slow;
unsigned char DAC_Slow;
//Led显示变量
unsigned char ucled;
//数码管显示变量
unsigned char string[10];
unsigned char buf[8]={0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
unsigned char pos;
//Key变量
unsigned char Key_Old;
//模式转换变量
bit S4_mode=0;
bit S5_mode=0;
float DAC_para;
float T_para;
unsigned char Sun_para;
void Delay600ms() //@12.000MHz
{
unsigned char i, j, k;
_nop_();
_nop_();
i = 28;
j = 92;
k = 196;
do
{
do
{
while (--k);
} while (--j);
} while (--i);
}
int main()
{
Sys_Init();
Timer1Init();
EA=1;
rd_temperature();
Pcf8591_ADC(Res_Sun);
Delay600ms();
while(1)
{
DAC_Proc();
Key_Proc();
Led_Proc();
Smg_Proc();
}
}
void tm1_isr() interrupt 3
{
if(++Key_Slow == 20) Key_Slow=0;
if(++Led_Slow == 100) Led_Slow=0;
if(++Smg_Slow == 500) Smg_Slow=0;
if(++DAC_Slow == 150) DAC_Slow=0;
Led_Disp(ucled);
Smg_Disp(buf,pos);
if(++pos == 8) pos=0;
}
void Key_Proc()
{
unsigned char Key_Value,Key_Down;
if(Key_Slow) return;
Key_Slow=1;
Key_Value=Read_KBD();
Key_Down=Key_Value&(Key_Value^Key_Old);
Key_Old=Key_Value;
switch(Key_Down)
{
case 4:
if(S5_mode == 0)
S4_mode^=1;
break;
case 5: S5_mode^=1; break;
}
}
void Led_Proc()
{
if(Led_Slow) return;
Led_Slow=1;
if(S4_mode == 0)
ucled = ucled&0xfc|0x01;
else
ucled = ucled&0xfc|0x02;
}
void Smg_Proc()
{
if(Smg_Slow) return;
Smg_Slow=1;
Pcf8591_DAC((unsigned char)DAC_para);
if(S5_mode == 0)
{
if(S4_mode == 0)
sprintf(string,"1 %3.1f",(unsigned int)rd_temperature()/16.0);
else
sprintf(string,"2 %3d",(unsigned int)Pcf8591_ADC(Res_Sun));
}
else
{
sprintf(string,"U %2.1f",(unsigned int)DAC_para/51.0);
}
Smg_Trans(string,buf);
}
void DAC_Proc()
{
if(DAC_Slow) return;
DAC_Slow =1;
if(S5_mode == 1)
{
if(S4_mode == 0)
{
T_para=rd_temperature()/16.0;
if(T_para <= 10)
DAC_para=51;
else if(T_para >= 40)
DAC_para=255;
else
DAC_para=6.8*T_para -17;
}
else
{
Sun_para=Pcf8591_ADC(Res_Sun);
if(Sun_para <= 10)
DAC_para=51;
else if(Sun_para >= 240)
DAC_para=255;
else
DAC_para=0.9*Sun_para+42.1;
}
}
else
DAC_para=0;
}
文章浏览阅读2.7k次。本文版权归博客园 mavaL所有,如有转载请按如下方式详细标明原创作者及出处,以示尊重!!原创作者:mavaL原文链接:DirectX9 ShadowMap例子学习笔记学习SDK例子真是快速加强编程能力的途径,然而虽如此,微软不仅在每个例子中展示了本_g_aminitobjworld
文章浏览阅读3.6k次。解决:在bootstrap-datetimepicker.js中,找到getDate: function () { var d = this.getUTCDate(); if (d === null) { return null; } return new Date(d.getTime() + (d.getTimezoneOf..._bootstrap-datetimepicker.min.js?v=2.4.4:1 uncaught typeerror: cannot read pr
文章浏览阅读1.3k次。本篇文章依然是有关TP2的内容。TP2主要思想:跳出整型浮点型的限制,定义新的容量比较大的数据类型,从而实现一些大数运算看了一些网上的算法和代码,也从前辈文章里得到一些灵感,产出一个用C语言实现大数相乘的算法废话不多说,直接上算法和代码t_EntierLong multiplication(t_EntierLong n1,t_EntierLong n2){ int i,j,m,c;//m是进位变量 t_EntierLong result; result.Negatif=f_两个大数相乘c语音
文章浏览阅读333次。本文来自民工哥微信上的文章1.ls [选项] [目录名 | 列出相关目录下的所有目录和文件-a 列出包括.a开头的隐藏文件的所有文件-A 通-a,但不列出"."和".."-l 列出文件的详细信息-c 根据ctime排序显示-t 根据文件修改时间排序---color[=WHEN] 用色彩辨别文件类型 WHEN 可以是'never'、'always'或'auto'其中之一..._将搜索结果输出到用户主目录下的my.txt文件
文章浏览阅读152次。#if #elif [defined(), !defined()] #else #ifdef #ifndef #endif // 条件编译/* 头文件防止多次被包含 */#ifndef ZLIB_H#define ZLIB_H#endif /* ZLIB_H *//* 用C方式来修饰函数与变量 */#ifdef __cplusplus..._预处理指令或编译器优化
文章浏览阅读347次。点滴积累一、Python中的map()函数与lambda()函数1.1 map()函数1.2 lambda()函数一、Python中的map()函数与lambda()函数1.1 map()函数用法:map(function, iterable, …)参数function: 传的是一个函数名,可以是python内置的,也可以是自定义的。参数iterable: 传的是一个可以迭代的对象,例如列表,元组,字符串…功能: 将iterable中的每一个元素执行一遍function例子一:例如,_python怎么输出deff
文章浏览阅读465次,点赞2次,收藏3次。Day 33Day 34_句句真研每日一句答案在哪
文章浏览阅读620次。所以说一个现代化的项目,是一个非常复杂的构成,我们需要一个人来掌控全局,他不需要是各种技术的资深专家,但他需要熟悉到各种技术。全栈只是个概念,我们要明白全栈也是有分非常多类别的,真正的全栈工程师涵盖了web开发,DBA、爬虫、测试等各种技能,要学的内容也是相当大的。很多小伙伴想知道python全栈是什么意思,那么今天小编就通过这篇文章来给大家详细讲解一下什么是python的全栈,感兴趣的小伙伴一定要耐心阅读一下这篇文章。以上就是小编给大家带来的python全栈是什么意思的相关知识了。_什么是python全栈
文章浏览阅读709次。nginx和nginx-gridfs都装好了,有些坑可能和版本有很大关系Nginx重新编译安装后访问不了了把项目配置文件的导入注释掉,直接用最小配置测试server { listen 80; server_name www.wyyxhlxy.com; location / { root html; index i..._nginx invalid mongo user/pass:
文章浏览阅读6.8k次,点赞6次,收藏25次。在仅有公共汽车和汽车两种交通方式的地区,假设有下述Logit交通方式选择模型,试用下表的现状出行时长、现状出行费用、现状划分率、将来出行时长、将来出行费用,求出这两种交通方式的将来划分率。划分率:PrijB=eVijBeVijB+eVijCPr_{ij}^{B}=\frac{e^{V_{ij}^{B}}}{e^{V_{ij}^{B}}+e^{V_{ij}^{C}}}PrijB=eVijB+eVijCeVijB PrijC=1−PrijBPr_{ij}^{C}=1-Pr_{ij}^{B}Prij_logit模型python实现交通方式划分
文章浏览阅读7.5w次,点赞37次,收藏222次。Navicat 是一款功能强大的数据库管理工具,可支持多种数据库类型,如 MySQL、Oracle、SQLite、Redis、PostgreSQL 等等。随着数据管理的重要性越来越受到重视,Navicat 的使用率也开始逐渐上升。本文将为您详细介绍 2023 最新版 Navicat 的下载、安装和基本使用方法。通过图文详解,帮助您轻松上手使用 Navicat,提高数据库管理的效率。_navicat下载
文章浏览阅读6.2k次。elementUI中的表格组件el-table性能不优,数据量大的时候,尤其是可操作表格,及其容易卡顿。_element表格数据多了卡