此贴终结,勿回
时间:10-02
整理:3721RD
点击:
想让GPIOB_Pin_5置高电平的,结果测出来是0v代码如下
主函数:
- #include "stm32f10x.h"
- #include"testIO.h"
- int main(void)
- {
- LCD_Com_GPIO_Config();
- GPIOB->BRR = 0x00000020 ;
- <font color="#ff0000">//GPIO_SetBits(GPIOB, GPIO_Pin_5); // 把这句注释去掉就能测得输出高电平了</font>
- }
- #include"testIO.h"
- void LCD_Com_GPIO_Config(void)
- {
- GPIO_InitTypeDef GPIO_InitStructure;
- RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOB, ENABLE);
-
- GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 ;
- GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
- GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
-
- GPIO_Init(GPIOB, &GPIO_InitStructure);
- }
testIO.h
- #ifndef _testIO_h_
- #define _testIO_h_
- /***********************************************************************************/
- #include "stm32f10x.h"
- #define PIN_5_H GPIOB->BRR = 0x00000020
- #define PIN_5_L GPIOB->BSRR = 0x00000020
- void LCD_Com_GPIO_Config(void);
- /**********************************************************************************/
- #endif
//GPIO_SetBits(GPIOB, GPIO_Pin_5); // 把这句注释去掉就能测得输出高电平了
也就是寄存器操作无效了
