中级会员
 
- 积分
- 331
- 金钱
- 331
- 注册时间
- 2016-10-12
- 在线时间
- 53 小时
|
#define uint16_t unsigned short
#define uint32_t unsigned int
#define SCB_CPACR *((uint32_t *)(0xE000ED88UL))
#define RCC_AHB1ENR *((uint32_t *)(0x40023830UL))
#define GPIOB_MODER *((uint32_t *)(0x40020400UL))
#define GPIOB_ODR *((uint32_t *)(0x40020414UL))
void Delay_ms(uint16_t ms)
{
uint16_t i,j;
for(i=0;i<ms;i++)
for(j=0;j<2000;j++);
}
void SystemInit()
{
SCB_CPACR|=(0xf<<20);
}
int main()
{
RCC_AHB1ENR|=(1<<1); //使能GPIOB
GPIOB_MODER|=5; //B0、B1为推挽输出
GPIOB_ODR|=1; //B0置高
while(1)
{
GPIOB_ODR^=3; //B0、B1取反
Delay_ms(500);
}
}
以上程序,不需要添加任何库,但启动文件还是需要的。在原子哥的F767板上测试通过。
|
|