3732| 4
|
买的国产DS18B20温度传感器,用STM32例程没动检测温度为0,用51的程序正常显示温度数值。 |
1金钱
最佳答案void Ds18B20_Output()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOG,ENABLE); //使能PG时钟
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_11; //PG11口
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP; //设定I/O口推挽输出
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(GPIOG,&GPIO_InitStructure);
}
void Ds18B20_Input()
{
GPIO_InitTypeDef ...
| ||
| ||
| ||
| ||
| ||
|手机版|OpenEdv-开源电子网
( 粤ICP备12000418号-1 )
GMT+8, 2025-6-22 20:42
Powered by OpenEdv-开源电子网
© 2001-2030 OpenEdv-开源电子网