📄 main.c
字号:
//======================================================================
// The information contained herein is the exclusive property of
// Sunnnorth Technology Co. And shall not be distributed, reproduced,
// or disclosed in whole in part without prior written permission.
// (C) COPYRIGHT 2003 SUNNORTH TECHNOLOGY CO.
// ALL RIGHTS RESERVED
// The entire notice above must be reproduced on all authorized copies.
//======================================================================
//====================================================================================
//工 程 名: Thermometer.spj
//功能描述: 热敏电阻温度计:利用61板的KEY3键控制温度测量,每按一次KEY3键,61板播放一次温度值及温馨提示
//包含文件: main.c\Tem_Meature.c\PlayVoice.c
// isr.asm\hardware.asm\AD.asm
// SPCE061A.h
// SPCE061A.inc
//硬件连接: 用10pin排线连接IOA的低8位与传感器模组的J2
//维护记录: 2006年7月12 v1.0 by hongyan.Feng
//====================================================================================
//====================================================================================
//文 件 名: main.c
//功能描述: 利用61板的KEY3键控制温度测量
//维护记录: 2006年6月29 by hongyan.Feng
//====================================================================================
#include "SPCE061A.h"
extern void Key_Init(void); //键盘初始化函数,在Key.c中定义
extern unsigned int KeyScan(void); //键盘扫描函数,在Key.c中定义
extern unsigned int Temp_Measure(void); //温度测量函数,在Tem_Meature.c中定义
extern void PlaySnd(unsigned int SndIndex); //申明语音播放指定段语音的函数
extern void PlayData(unsigned int iData); //申明语音播放某一个3位数字的函数
//====================================================================================
//语法格式:int main(void)
//功能描述: 主函数,根据按键与否进行温度测量
//入口参数: 无
//出口参数: 无
//维护记录: 2006年7月12 by hongyan.Feng
//====================================================================================
int main(void)
{
unsigned int Key,Temp; //保存键值
Key_Init(); //键盘初始化
while(1)
{
Key = KeyScan(); //键盘扫描,取键值
if(Key == 0x0004) //如果是KEY3键按下
{
Temp = Temp_Measure(); //测量并播放温度
if((Temp>=0)||(Temp<=125)) //在测量范围内
{
// PlaySnd(20); //播放"现在"
PlaySnd(13); //播放"温度"
PlayData(Temp); //播放温度值,PlayData()函数在PlayVoice.c文件中定义
PlaySnd(12); //播放"摄氏度"
if(Temp>32)
{
PlaySnd(13); //播放"温度"
PlaySnd(14); //播放"太高"
PlaySnd(16); //播放"请"
PlaySnd(17); //播放"调大"
PlaySnd(19); //播放"空调"
}
if(Temp<15)
{
PlaySnd(13); //播放"温度"
PlaySnd(15); //播放"太低"
PlaySnd(16); //播放"请"
PlaySnd(18); //播放"调小"
PlaySnd(19); //播放"空调"
}
}
}
*P_IOA_Data &= 0xfffb; //IOA2口回低电平
*P_Watchdog_Clear = 0x0001; //清看门狗
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -