版权声明:转载博客需经博主允许,未经允许禁止转载 https://blog.csdn.net/qq_41673920/article/details/86678178
#define GPIOCOUT *((volatile unsigned int *)0xc001c000)
#define GPIOCOUTENB *((volatile unsigned int *)0xc001c004)
#define GPIOCALTFN0 *((volatile unsigned int *)0xc001c020)
void delay(unsigned int);
void led_test(void)
{
/*配置选择GPIOC12管脚的功能1*/
GPIOCALTFN0 &= ~(3<<24);//清0 bit24 25
GPIOCALTFN0 |= (1<<24);//置1 bit24
/*设置为输出模式*/
GPIOCOUTENB |= (1<<12);
while(1)
{
/*亮*/
GPIOCOUT &= ~(1<<12);//清0 bit12
delay(0x1000000) ;
/*灭*/
GPIOCOUT |= (1<<12);//置1输出高电平
delay(0x1000000) ;
}
}
void delay(unsigned int n)
{
while(n--) ;
}