初级会员

- 积分
- 143
- 金钱
- 143
- 注册时间
- 2014-12-12
- 在线时间
- 4 小时
|
5金钱
void LED_Init(void)
{
RCC->APB2ENR|=1<<3; //使能PORTB时钟
RCC->APB2ENR|=1<<2; //使能PORTA时钟
GPIOB->CRL&=0XFF0FFFFF;
GPIOB->CRL|=0X00300000;//PB.5 推挽输出
GPIOB->ODR|=1<<5; //PB.5 输出高
GPIOA->CRL&=0XFF0FFFFF;
GPIOA->CRL|=0X00300000;//PA.5推挽输出
GPIOA->ODR|=1<<5; //PA.5输出高
}
//LED端口定义
#define LED0 PBout(5)// DS0
#define LED1 PAout(5)// DS1
void LED_Init(void);//初始化
#endif
int main(void)
{
Stm32_Clock_Init(9);
delay_init(72);
LED_Init();
while(1)
{
LED0=0;
LED1=1;
delay_ms(300);
LED0=1;
LED1=0;
delay_ms(300);选项
}
}
程序只有接PB5时灯亮,接PA5的时候就不亮了,求指导~~~ |
|