shengxiaozhu 发表于 2020-8-27 15:55:58

STM32F1 联级74HC165 Q7反馈电平一直是低什么原因呢?

电路图部分:




软件部分:



#define HC165_PL         PCout(13)         //pl      
#define HC165_CLK      PCout(14)          //cp

#define HC165_DAT      HAL_GPIO_ReadPin(GPIOC,GPIO_PIN_15)   //Q7

探物传感器的状态是:电平为高(没有物品)低电平(有物品)
各位大佬帮看看什么原因

tanic 发表于 2020-8-27 17:30:10

1.   HC165_DAT!=0
2.   你确定你那个for循环中CLK的波形没问题? CLK拉高之后稍微延时一下

jason0821 发表于 2020-8-30 13:57:15

会不会是 AFIO 设定接脚, 没切换到 GPIO?

PC14, PC15 -> 在部分 STM32F1 的封装中, 对应到LSE Crystal 32.768KHz会不会是AFIO 没切换到GPIO?

jason0821 发表于 2020-8-30 14:11:03

会不会是 AFIO 设定接脚, 没切换到 GPIO?

PC14, PC15 -> 在部分 STM32F1 的封装中, 对应到LSE Crystal 32.768KHz会不会是AFIO 设定接脚, 没切换到GPIO? UsingOSC32_IN/OSC32_OUT pins as GPIO ports PC14/PC15The LSEoscillator pins OSC32_IN and OSC32_OUT can be used as general-purpose I/OPC14 and PC15,respectively, when the LSE oscillator is off. The LSE has priority over theGP IOs function.Note: ThePC14/PC15 GPIO functionality is lost when the 1.8 V domain is powered off (byenteringstandby mode) or when the backup domain is supplied by VBAT (VDD no moresupplied).In this case the IOs are set in analog mode.Refer to the note on IO usage restrictions in Section5.1.2: Battery backup domain.
页: [1]
查看完整版本: STM32F1 联级74HC165 Q7反馈电平一直是低什么原因呢?