初级会员

- 积分
- 53
- 金钱
- 53
- 注册时间
- 2014-9-11
- 在线时间
- 0 小时
|

楼主 |
发表于 2014-10-3 12:57:05
|
显示全部楼层
谢谢大家,我最后是这么做的:
void InitGPIO(GPIO_TypeDef* GPIOx)
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOB,&GPIO_InitStructure); }
void WriteData(u8 data)
{
GPIO_WriteBit(GPIOx,  in1,(data & 0x80) >> 7 );
GPIO_WriteBit(GPIOx,  in2,(data & 0x40) >> 6 );
GPIO_WriteBit(GPIOx,  in3,(data & 0x20) >> 5 );
GPIO_WriteBit(GPIOx,  in4,(data & 0x10) >> 4 );
GPIO_WriteBit(GPIOx,  in5,(data & 0x08) >> 3 ) ;
GPIO_WriteBit(GPIOx,  in6,(data & 0x04) >> 2 );
GPIO_WriteBit(GPIOx,  in7,(data & 0x02) >> 1 );
GPIO_WriteBit(GPIOx,  in8,data & 0x01); |
|