文件名称:STM32F103的DS1820温度测量工程代码包+DS1820中文资料
文件大小:5.54MB
文件格式:ZIP
更新时间:2022-01-27 10:07:41
STM32F103 DS1820
DS18b20与Stm32f103c8t8的接线 DQ-----PB9 VCC----3.3v GND----GND 主程序 int main(void) { char buf[10]; unsigned int temper; delay_init(); NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); uart_init(115200); //初始化串口,波特率为115200 LED_GPIO_Configuration(); //初始化LED灯 USART_SendStr(USART1,"温度测量:"); while (1) { temper = DS18B20_Read_Temp(); sprintf(buf,"%d.%d",temper/10,temper); USART_SendStr(USART1,"当前温度为:"); USART_SendStr(USART1,buf); USART_SendStr(USART1," C\n"); LEDToggle(1000); //指示灯闪烁,每1s打印一次温度 } }