標題:
STM32F103+LCD1602+DSB18B20源程序 求幫助
[打印本頁]
作者:
張桐
時間:
2020-10-9 17:07
標題:
STM32F103+LCD1602+DSB18B20源程序 求幫助
可以作為學習使用
51hei.png
(17.18 KB, 下載次數(shù): 40)
下載附件
2020-10-9 19:12 上傳
單片機源程序如下:
/*----------------------------------------------------------------------------
* Name: Blinky.c
* Purpose: tested by hardware; but can not run on proteus platform
* Version: V1.00
*----------------------------------------------------------------------------*/
#include "stm32f10x.h"
#include "system.h"
#include "LCD1602.h"
#include "DS18B20.h"
#include "stdio.h"
unsigned char i;
unsigned char a[16];
struct temp tt;
int main (void)
{
RCC->APB2ENR|=(1<<2); //enable port A clock
GPIOA->CRL=0x33333333; //50Mhz, push-pull
GPIOA->CRH=0x00033003; //PA8,PA11,PA12 of LCD1602
RCC->APB2ENR|=(1<<3);//DS18B20
LCDInit();
LCDHideCursor();
while(1)
{
//delay_ms(1000);
tt=Read_Temperature();
//Delay(0x0FFFEF);
sprintf(&a[0],"%6.2f",(float)((tt.H<<8)+tt.L)/16);
// sprintf(&a[0],"%5d",i);
//GPIO_SetBits(GPIOA,1<<i);
SetCurPos(1,1);
LCDPrint(&a[0]);
i++;
}
}
復制代碼
所有資料51hei提供下載:
4_LCD1602&&DS18B20.7z
(283.56 KB, 下載次數(shù): 25)
2020-10-9 19:14 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
歡迎光臨 (http://www.torrancerestoration.com/bbs/)
Powered by Discuz! X3.1