基于msp430g2553的ds18b20测温程序.pdfVIP

  • 0
  • 0
  • 约2.46万字
  • 约 25页
  • 2024-05-28 发布于江苏
  • 举报

-

/*

*main.c

*/

/***********************************************************************************

**********************

includeheaderfile

************************************************************************************

*********************/

*includemsp430g2553.h

*includesystem.h

*includeuart.h

*includeds18b20.h

unsignedinttemp;

chart*_buf[6]={0,0,0,0,\n,\0};

/***********************************************************************************

**********************

**Functionname:main

**Descriptions:mainfunction

**inputparameters:none

**outputparameters:none

**Returnedvalue:none

************************************************************************************

.z.

-

*********************/

voidmain(void)

{

System_Init();

UartInit();

_EINT();

if(DS18B20_Init())

{

P1OUT|=BIT0;

}

else

{

P1OUT|=BIT6;

}

while(1)

{

__delay_cycles(800000);

__delay_cycles(800000);

temp=DS18B20_GetTemp();

//*_buf[0]=temp%10000/1000+0;

//t*_buf[1]=temp%1000/100+0;

//t*_buf[2]=temp%100/10+0;

.z.

-

//t*_buf[3]=temp%10+0;

t*_buf[0]=temp%100/10+0;

t*_buf[1]=temp%10+0;

Uart_SendStr(t*_buf);

}

}

/***********************************************************************************

**********************

Includeheaderfile

************************************************************************************

***************

文档评论(0)

1亿VIP精品文档

相关文档