標題: STM32F103ZE學(xué)習(xí)之GPIO口的設(shè)置 [打印本頁]
作者: xiaos 時間: 2015-4-10 17:37
標題: STM32F103ZE學(xué)習(xí)之GPIO口的設(shè)置
void GPIO_Configuration()
{
GPIO_InitTypeDef GPIO_InitStructure;//定義有關(guān)GPIO設(shè)置的結(jié)構(gòu)體 做GPIO_Init()的參數(shù);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);//打開GPIOB的時鐘
GPIO_InitStructure.GPIO_Pin=GPIO_Pin0;//選擇0管腳
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHZ;//選擇輸出速率為50MHZ
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
//選擇管腳的模式為推挽式輸出(GPIO_Mode_AIN 模擬輸入 .GPIO_Mode_IN_FLOATING 浮空輸入 .GPIO_Mode_IPD 下拉輸入. GPIO_Mode_IPU 上拉輸入.GPIO_Mode_Out_OD 開漏輸出. GPIO_Mode_Out_PP 推挽輸出.GPIO_Mode_AF_OD 復(fù)用開漏輸出 .GPIO_Mode_AF_PP 復(fù)用推挽輸出.)
GPIO_Init(GPIOB,&GPIO_InitStructure);調(diào)用GPIO_Init函數(shù)設(shè)置管腳的參數(shù)
}
歡迎光臨 (http://www.torrancerestoration.com/bbs/) |
Powered by Discuz! X3.1 |