stm32写入读取整组gpio数据

fe07fe7个月前 (10-09)未分类146
 GPIO_InitTypeDef  GPIO_InitStructure;
 	
 RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);	 
	
 GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;			//全部选择	 
 GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 		 //
 GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;		 //
 GPIO_Init(GPIOB, &GPIO_InitStructure);					 //
// GPIO_SetBits(GPIOB,GPIO_Pin_5);						 //
//GPIOB->BSRR=0xff;
	GPIOB->ODR=0xffff;                                //全部写入高电平
// GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5;	    		 //
 //GPIO_Init(GPIOE, &GPIO_InitStructure);	  				 //
 //GPIO_SetBits(GPIOE,GPIO_Pin_5); 						 //
(uint16_t)GPIOB->IDR; //强转成16位数据,应为只是用了低16位


typedef unsigned short     int uint16_t;        //

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。