?? tmp_example.c
字號:
/************************************************************************************
* Copyright (c), 2004-2007,西安銘朗電子科技有限責任公司
* All rights reserved.
*
* Http: www.mlarm.com
* Email: mlarm@mlarm.com
*
* File name: Tmp_Example.c
* Project : ML-F020ICB
* Processor: C8051F020
* Compiler : Keil C51 Compiler
*
* Author: 李林利
* Version: 1.20
* Date: 2007.6.1
* Email: GavinLi@126.com
*
* Description: 本文件是讀取18B20溫度測試程序文件;
*
* Others: none;
*
* Function List:
* 1. void Tmp_Proc(void)
*
* History:
* 1. Author: 李林利
* Version: 1.10
* Date: 2007.3.12
* Modification: none
*
* 2. Author: 李林利
* Version: 1.00
* Date: 2004.11.24
* Modification: 建立文件
*
*************************************************************************************/
/************************************************************************************/
// 引用外部頭文件
#include "..\config\C8051f020.h"
#include "..\config\Const.h"
#include "..\driver\uart.h"
#include "..\driver\delay.h"
#include "main.h"
/************************************************************************************/
/************************************************************************************/
// 常量及全局變量定義
/************************************************************************************/
/*************************************************************************************/
//
// 讀取18B20溫度測試程序函數定義
//
/*************************************************************************************/
/***********************************************************************************
* Function: Tmp_Proc;
*
* Description: 讀取18B20溫度測試程序;
*
* Input: none;
*
* Return: none;
*
* Note: none;
************************************************************************************/
void Tmp_Proc(void)
{
unsigned int val;
int tmp;
unsigned char i;
Uart0_SendBlock("Tmp test starting!\n\r",21,&val);
for (i=0;i<5;i++)
{
Tmp_Init();
Delay_ms(500);
tmp = Tmp_Read();
tmp = tmp>>4;//*0.25;//0.0625;
Uart0_SendBlock("Tmp = ",7,&val);
Send_Data(tmp);
Uart0_SendBlock("\n\r",2,&val);
}
Uart0_SendBlock("Tmp test end!\n\r", 16, &val);
}
/***********************************************************************************/
// 文件結束
/***********************************************************************************/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -