tmp_example.c
来自「西安明朗公司开发板ML-F020ICB的全部测试代码」· C语言 代码 · 共 95 行
C
95 行
/************************************************************************************
* 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 + =
减小字号Ctrl + -
显示快捷键?