初级会员

- 积分
- 86
- 金钱
- 86
- 注册时间
- 2017-7-12
- 在线时间
- 46 小时
|
while(1)
{
u32 word=11111010;
switch(word&(0x01<<0))
{
case 0:GPIO_ResetBits(GPIOA,GPIO_Pin_1);
break;
case 1:GPIO_SetBits(GPIOA,GPIO_Pin_1);
break;
}
switch(word&(0x01<<1))
{
case 0:GPIO_ResetBits(GPIOA,GPIO_Pin_2);
break;
case 1:GPIO_SetBits(GPIOA,GPIO_Pin_2);
break;
}
switch(word&(0x01<<2))
{
case 0:GPIO_ResetBits(GPIOA,GPIO_Pin_3);
break;
case 1:GPIO_SetBits(GPIOA,GPIO_Pin_3);
break;
}
switch(word&(0x01<<3))
{
case 0: GPIO_ResetBits(GPIOA,GPIO_Pin_4);
break;
case 1: GPIO_SetBits(GPIOA,GPIO_Pin_4);
break;
}
switch(word&(0x01<<4))
{
case 0:GPIO_ResetBits(GPIOA,GPIO_Pin_5);
break;
case 1:GPIO_SetBits(GPIOA,GPIO_Pin_5);
break;
}
switch(word&(0x01<<5))
{
case 0:GPIO_ResetBits(GPIOA,GPIO_Pin_6);
break;
case 1:GPIO_SetBits(GPIOA,GPIO_Pin_6);
break;
}
switch(word&(0x01<<6))
{
case 0:GPIO_ResetBits(GPIOA,GPIO_Pin_7);
break;
case 1:GPIO_SetBits(GPIOA,GPIO_Pin_7);
break;
}
switch(word&(0x01<<7))
{
case 0:GPIO_ResetBits(GPIOA,GPIO_Pin_8);
break;
case 1:GPIO_SetBits(GPIOA,GPIO_Pin_8);
break;
}
}
这段程序,不管我怎么样改变word的值,PA4和PA5的电平跟预期总是相反的,如上所示,PA4和PA5应该为高电平,但是实际烧入单片机后测得为低电平,特来求助各位 |
|