main.c

来自「温度传感器ds18b20调试源代码」· C语言 代码 · 共 59 行

C
59
字号
//========================================================
//	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.
//========================================================

//========================================================
//	工程名称:	18B20_Show
//	功能描述:	课程设计实验参考
//				利用DS18B20测量温度,并将温度显示在数码管上
//	涉及的库:	CMacro.lib
//	组成文件:	main.c
//	硬件连接:	IOA15连接DS18B20的数据线DQ
//				IOA口的低8位与6位数码管的Segment相连
//				IOB口的IOB15、IOB14、IOB13、IOB12、IOB2、IOB1分别控制数码管的位选
//	维护记录:	2005-09-12	v1.0
//
//========================================================

//========================================================
//	文件名称:	main.c
//	功能描述:	利用DS18B20测量温度,并将温度显示在数码管上
//	维护记录:	2005-09-29	v1.0
//========================================================

//========================================================
//	语法格式:	int main(void)
//	实现功能:	利用DS18B20测量温度,并将温度显示在数码管上
//	参数:		无
//	返回值:	无
//========================================================

#include "spce061v004.h"
#include "new_18b20.h"
unsigned int  Data_table[8];
unsigned int  set_bit;
unsigned char temp_flag=1;

main()
{
	float uiTemp=0;
	
	*P_SystemClock = 0x0018;
	*P_IOA_Attrib = 0xffff;
	*P_IOA_Dir = 0xffff;
	*P_IOA_Data = 0x0000;
	*P_SIO_Ctrl = 0x00C3; 
	set_bit=0x4000;
    uiTemp=get_temp();
	while(1)
	{
     	show_temp(uiTemp);
		*P_Watchdog_Clear = 0x0001;
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?