打印

onenet迷你板

[复制链接]
611|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
博斯|  楼主 | 2020-3-28 15:22 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
新手,刚刚接触stm32,有一块onenet迷你板。
用以下代码点亮灯 led2。
编译未报错,但是灯就是不亮。
#include "stm32f10x.h"

int main(void)
{

    RCC_APB2ENR |= ((1) << 3);
    GPIOB_CRL &= ~(0x0f << (4*6));        //先清零
    GPIOB_CRL |= (1 << (4*6));   
    GPIOB_ODR &= ~(1 << 6);

}
void SystemInit(void)
{
   
}
//stm32f10x.h
//外设 peripheral
#define PERIPH_BASE                        ((unsigned int*)0x40000000)
#define APB1PERIPH_BASE                PERIPH_BASE
#define APB2PERIPH_BASE                (PERIPH_BASE + 0x10000)
#define AHBPERIPH_BASE                (PERIPH_BASE + 0x20000)

#define RCC_BASE                            (AHBPERIPH_BASE + 0x1000)
#define GPIOB_BASE                            (APB2PERIPH_BASE + 0x0C00)

#define RCC_APB2ENR                        *(unsigned int*)(RCC_BASE + 0x18)

#define GPIOB_CRL                         *(unsigned int*)(GPIOB_BASE + 0x00)
#define GPIOB_CRH                         *(unsigned int*)(GPIOB_BASE + 0x04)
#define GPIOB_ODR                         *(unsigned int*)(GPIOB_BASE + 0x0C)

使用特权

评论回复

相关帖子

发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

412

主题

412

帖子

0

粉丝