偷偷碰在线视频天天|性高湖久久久久久久久aaaaa|美女拍拍拍免费视频网站|日韩高清dvd|97夜夜澡人人爽人人喊一欧美

當前位置: 上海銘靜電子科技有限公司 » 單片機

STM32要使用JTMS(PA13)、 JTCK(PA14)作為普通I/O口

分類:單片機 發布:2018年05月13日 15:31 瀏覽:927次 Tag:

在STM32要使用JTMS(PA13)、  JTCK(PA14)作為普通I/O口的時候,要在初始化前添加如下代碼(順序不能顛倒):

  RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);

GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable , ENABLE);


如:

void LED_Init(void)
{
 
 GPIO_InitTypeDef  GPIO_InitStructure;
     
    
    
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA|RCC_APB2Periph_AFIO, ENABLE);  
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable , ENABLE);

    GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8;                
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;     
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 GPIO_SetBits(GPIOA,GPIO_Pin_8);                       

 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;           
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;      
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 GPIO_ResetBits(GPIOA,GPIO_Pin_13);                         
    
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_14;                 
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;          
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 GPIO_ResetBits(GPIOA,GPIO_Pin_14);        

 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6;              
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;       
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 GPIO_Init(GPIOA, &GPIO_InitStructure);
 GPIO_ResetBits(GPIOA,GPIO_Pin_6);            

 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);  

 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_2;               
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;       
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 
 GPIO_Init(GPIOD, &GPIO_InitStructure);    
 GPIO_SetBits(GPIOD,GPIO_Pin_2);                       

}


相關文章
 
資訊欄目
最新資訊
資訊排行
 

收縮
  • 電話咨詢

  • 021-31007558