ds18b20-stm32

所属分类:单片机开发
开发工具:C/C++
文件大小:4561KB
下载次数:147
上传日期:2013-04-06 16:15:48
上 传 者wangzheng12
说明:  实现了温度传感器ds18b20与stm32的通信和stm32与主机的通信,可以通过串口通信助手接收stm32发送的信息,在电脑上显示温度值。
(The temperature sensor ds18b20 of communications and stm32 stm32 host communication stm32 send the information can be received through the serial port communication assistant temperature value is displayed on the computer.)

文件列表:
ds1820\DS18b20.c (6585, 2013-02-03)
ds1820\DS18b20.h (1731, 2013-02-03)
ds1820\Systick_Delay.c (886, 2013-02-03)
ds1820\Systick_Delay.h (78, 2013-02-03)
ds1820\Usart (0, 2013-02-04)
ds1820\Usart\Lib (0, 2013-02-04)
ds1820\Usart\Lib\cmsis (0, 2013-02-04)
ds1820\Usart\Lib\cmsis\core_cm3.c (17273, 2012-10-23)
ds1820\Usart\Lib\cmsis\core_cm3.h (85714, 2012-10-23)
ds1820\Usart\Lib\cmsis\stm32f10x.h (633941, 2012-10-23)
ds1820\Usart\Lib\cmsis\stm32f10x_systick.c (5937, 2012-10-23)
ds1820\Usart\Lib\cmsis\stm32f10x_systick.h (3092, 2012-10-23)
ds1820\Usart\Lib\cmsis\system_stm32f10x.h (2085, 2012-10-23)
ds1820\Usart\Lib\inc (0, 2013-02-04)
ds1820\Usart\Lib\inc\misc.h (8982, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_adc.h (21690, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_bkp.h (7555, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_can.h (27559, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_cec.h (6573, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_crc.h (2162, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_dac.h (15233, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_dbgmcu.h (3818, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_dma.h (20754, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_exti.h (6824, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_flash.h (25445, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_fsmc.h (27016, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_gpio.h (20175, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_i2c.h (30029, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_iwdg.h (3828, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_lib.h (2934, 2007-10-08)
ds1820\Usart\Lib\inc\stm32f10x_pwr.h (4383, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_rcc.h (30452, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_rtc.h (3857, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_sdio.h (21863, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_spi.h (17725, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_tim.h (52427, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_usart.h (16548, 2012-10-23)
ds1820\Usart\Lib\inc\stm32f10x_wwdg.h (2966, 2012-10-23)
ds1820\Usart\Lib\src (0, 2013-02-04)
ds1820\Usart\Lib\src\misc.c (7046, 2012-10-23)
... ...

copy了大部分,只有小修改,可以用串口通信助手显示数据,以上只是设想。 由于我没有带ds18b20,所以没有经实践检验。可能有部分错误。 ds18b20是什么工作方式??1-Wire bus 一根总线 The 1-Wire bus system uses a single bus master to control one or more slave devices. The DS18B20 is always a slave. When there is only one slave on the bus, the system is referred to as a “single-drop” system; the system is “multidrop” if there are multiple slaves on the bus. 主要是pdf的figure18 那里面有读写和复位的时序, 总线为write zero time slot时,可以看出来 高电平的时间是tslot-tlow0,低电平的时间是tLOW0,两者合起来的时间是tSLOT 那么也就是说发送0时,端口的高低电平时序,低电平可以再60us--120us之间,高电平在1us--15us 温度传感器接收的数据就为0,要写一个字节的数据给温度传感器,需要写八次, write 1 ,给温度传感器发送1,需要高电平在60-120之间,低电平在1-15之间 要是温度传感器复位的话,就是给端口发送超过480us的低电平脉冲, 参考资料ds18b20.pdf

近期下载者

相关文件


收藏者