打印

之前做过一个板子,现在下载了下面的程序,但是LED灯都不亮了,求解

[复制链接]
257|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
3月的尾巴|  楼主 | 2019-11-20 14:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
我用到了PC13/14/15,还有PA15,PA0,PB0,现在的情况是,LED灯都不亮,我仿真了一下,GPIO口的输入不对,求解
int main(void)
{        
         GPIO_LED_Configuration();         

        while (1)
        {
                LED1_ON;               
                Delay(0x0FFFFF);
                LED1_OFF;               

                LED3_ON;                          
                Delay(0x0FFFFF);
                LED3_OFF;                  

                LED4_ON;                        
                Delay(0x0FFFFF);
                LED4_OFF;                           
               
                LED5_ON;                        
                Delay(0x0FFFFF);
                LED5_OFF;               

                LED6_ON;                        
                Delay(0x0FFFFF);
                LED6_OFF;                           

                LED7_ON;                        
                Delay(0x0FFFFF);
                LED7_OFF;                                          
        }

}

void Delay(__IO uint32_t nCount)        
{
        for(; nCount != 0; nCount--);
}

void GPIO_LED_Configuration(void)
{
  GPIO_InitTypeDef GPIO_InitStructure;
  GPIO_PinRemapConfig(GPIO_Remap_SWJ_JTAGDisable,ENABLE);   
        
  GPIO_InitStructure.GPIO_Pin = PIN_LED1 ;                  
  GPIO_InitStructure.GPIO_Mode =  GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(PORT_LED1, &GPIO_InitStructure);


        
  GPIO_InitStructure.GPIO_Pin = PIN_LED3 ;
  GPIO_InitStructure.GPIO_Mode =  GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(PORT_LED3, &GPIO_InitStructure);
        
  GPIO_InitStructure.GPIO_Pin = PIN_LED4 ;
  GPIO_InitStructure.GPIO_Mode =  GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(PORT_LED4, &GPIO_InitStructure);
        
  GPIO_InitStructure.GPIO_Pin = PIN_LED5 ;
  GPIO_InitStructure.GPIO_Mode =  GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(PORT_LED5, &GPIO_InitStructure);
        
  GPIO_InitStructure.GPIO_Pin = PIN_LED6 ;
  GPIO_InitStructure.GPIO_Mode =  GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(PORT_LED6, &GPIO_InitStructure);
        
GPIO_InitStructure.GPIO_Pin = PIN_LED7 ;
  GPIO_InitStructure.GPIO_Mode =  GPIO_Mode_Out_PP;
  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
  GPIO_Init(PORT_LED7, &GPIO_InitStructure);
}
#define PORT_LED1  GPIOA  
#define PIN_LED1   GPIO_Pin_0

#define PORT_LED3  GPIOB  
#define PIN_LED3   GPIO_Pin_0

#define PORT_LED4  GPIOC  
#define PIN_LED4   GPIO_Pin_13

#define PORT_LED5  GPIOC
#define PIN_LED5   GPIO_Pin_14

#define PORT_LED6  GPIOC  
#define PIN_LED6   GPIO_Pin_15

#define PORT_LED7  GPIOA  
#define PIN_LED7   GPIO_Pin_15

#define LED1_ON    GPIO_SetBits(PORT_LED1, PIN_LED1)
#define LED1_OFF   GPIO_ResetBits(PORT_LED1, PIN_LED1)

#define LED3_ON    GPIO_SetBits(PORT_LED3, PIN_LED3)
#define LED3_OFF   GPIO_ResetBits(PORT_LED3, PIN_LED3)

#define LED4_ON    GPIO_SetBits(PORT_LED4, PIN_LED4)
#define LED4_OFF   GPIO_ResetBits(PORT_LED4, PIN_LED4)

#define LED5_ON    GPIO_SetBits(PORT_LED5, PIN_LED5)
#define LED5_OFF   GPIO_ResetBits(PORT_LED5, PIN_LED5)

#define LED6_ON    GPIO_SetBits(PORT_LED6, PIN_LED6)
#define LED6_OFF   GPIO_ResetBits(PORT_LED6, PIN_LED6)

#define LED7_ON    GPIO_SetBits(PORT_LED7, PIN_LED7)
#define LED7_OFF   GPIO_ResetBits(PORT_LED7, PIN_LED7)

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

433

主题

433

帖子

0

粉丝