高级会员

- 积分
- 533
- 金钱
- 533
- 注册时间
- 2014-5-17
- 在线时间
- 81 小时
|
发表于 2018-3-31 08:39:33
|
显示全部楼层
1.看了下手册,楼主的GPIO_TypeDef数据结构,不应该是,请注意uint16_t
[mw_shl_code=c,true]typedef struct
{
__IO uint32_t MODER; /*!< GPIO port mode register, Address offset: 0x00 */
__IO uint32_t OTYPER; /*!< GPIO port output type register, Address offset: 0x04 */
__IO uint32_t OSPEEDR; /*!< GPIO port output speed register, Address offset: 0x08 */
__IO uint32_t PUPDR; /*!< GPIO port pull-up/pull-down register, Address offset: 0x0C */
__IO uint32_t IDR; /*!< GPIO port input data register, Address offset: 0x10 */
__IO uint32_t ODR; /*!< GPIO port output data register, Address offset: 0x14 */
__IO uint16_t BSRRL; /*!< GPIO port bit set/reset low register, Address offset: 0x18 */
__IO uint16_t BSRRH; /*!< GPIO port bit set/reset high register, Address offset: 0x1A */
__IO uint32_t LCKR; /*!< GPIO port configuration lock register, Address offset: 0x1C */
__IO uint32_t AFR[2]; /*!< GPIO alternate function registers, Address offset: 0x20-0x24 */
} GPIO_TypeDef;[/mw_shl_code]
2. 楼主想点亮那个IO口啊?没说明!!需要注意一点,BSSR这个寄存器使用时,是写1才会改变IO口,写0等于没写。 |
|