传感器c语言编程教材,温度传感器c语言编程 - 副本(Temperature sensor C language programming - copy).doc...

温度传感器c语言编程 - 副本(Temperature sensor C language programming - copy)

温度传感器c语言编程 - 副本(Temperature sensor C language programming - copy)

I wrote 51 SCM 18B20 temperature sensor source (C language), very easy to use, and in the development board on the actual operation is very successful, is to learn 18B20 temperature sensor is a good reference! (unlike some people just paste a program, they don't know right or wrong)

* for 51 MCU development board V3.0 and V4.0.

/*51 microcontroller 18B20 temperature sensor source program (C language).

#include

#include

Sbit RS = P1^0;

Sbit RW = P1^1;

Sbit EN = P1^2;

Sbit TSOR = P3^7;

/*------------------------------------------ global variables -------------------------------------------------------*/

Static unsigned char temp1 temp2; / / the temperature value of the integer, decimal part

Static char line0[] = "00:00"";

"Static char line1[] =". C";

The /*-------------------------------------------LCD driver function ------------------------------------------------*/

Void, DelayL ();

Void, DelayS ();

Void WriteCommand (unsigned, char, C);

Void WriteData (unsigned, char, C);

Void ShowChar (unsigned, char, POS, unsigned, char, C);

Void ShowString (unsigned, char, line, char, *ptr);

Void, InitLcd ();

/*--------------------------------------------- -------------------------------------------*/ drive digital thermometer

Void ChangePos (bit, SEL, unsigned, char, pos1, unsigned, char, pos2);

/*------------------------------------------ temperature sensor driver ----------------------------------------------*/

Void, Delay15 ();

Void, Delay60 ();

Void, Delay100ms ();

Void, Write0TS ();

Void, Write1TS ();

Bit, ReadTS ();

Void, ResetTS ();

Void WriteByteTS (unsigned, char, byte);

Unsigned, char, ReadByteTS ();

Void, InitTS ();

Void, GetTempTS ();

The main program ---------------------------------------------------*/ /*-------------------------------------------------

Void main (void)

{

Char code str1[] = "Hello World"!";

Char code str2[] = "2006-12-12"";

Char code str3[] = "51mcu-v3.0"";

Uns

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值