📄 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.
//========================================================
//========================================================
// 工程名称: DS18B20_1602.spj
// 功能描述: 通过DS18B20温度传感器采集温度,由RS232输出
//
// 组成文件: main.c/ISR.c/DS18B20.c/UART.c
// DS18B20_1602.h/DS18B20.h/UART_User.h
// 硬件连接: IOB15 ---- DQ(DS18B20温度传感器)
// IOB7 ---- RX
// IOB10 ---- TX
// 维护记录: 2005-11-22 v1.0
// ****-**-** v1.x
//========================================================
//========================================================
// 文件名称: main.c
// 功能描述: 工程的主文件
// 维护记录: 2005-11-22 v1.0
//========================================================
//#include "DS18B20_1602.h"
#include "DS18B20.h"
#include "SPCE061A.h"
#include "UART_User.h"
#include "CryAnalysis.h"
//========================================================
// 语法格式: int main(void)
// 实现功能: 工程的主函数
// 参数: 无
// 返回值: 无
//========================================================
void main(void)
{
unsigned int uiTemperature; //存储温度
unsigned int status;
*P_SystemClock = 0x0018; //初始化,调整系统时钟24.576MHz/1,强振模式
*P_IOB_Attrib = 0xffff; //初始化IOB同相低电平输出口
*P_IOB_Dir = 0xffff;
*P_IOB_Data = 0x0000;
Init_CA();
Init_Uart(); //初始化串口
while(1)
{
Init_Uart(); //初始化串口
uiTemperature = Read_Temp(); //测温
status = read_CA();
//uiTemperature = 0xFFFF;
//status=0xFF;
Send_Data(uiTemperature,status); //上传,通过UART
*P_Watchdog_Clear = 0x0001; //清看门狗
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -