ARM S3C2410 从sdram启动流水灯(2) led.c

来源:互联网 发布:vue.js 分页插件 编辑:程序博客网 时间:2024/06/05 18:02

#define    GPFCON        (*(volatile unsigned long *)0x56000050)
#define    GPFDAT        (*(volatile unsigned long *)0x56000054)

#define    GPF4_out    (1<<(4*2))
#define    GPF5_out    (1<<(5*2))
#define    GPF6_out    (1<<(6*2))
#define    GPF7_out    (1<<(7*2))

void  wait(unsigned long dly)
{
    for(; dly > 0; dly--);
}

int main(void)
{
    unsigned long i = 4;
    
    GPFCON = GPF4_out|GPF5_out|GPF6_out|GPF7_out;        // 将LED1-4对应的GPF4/5/6/7四个引脚设为输出
    GPFDAT|=0xff<<4;
    while(1){
        wait(30000);
        GPFDAT = (~(1<<i));         // 根据i的值,点亮LED1-4
        if(i++ == 7)
            i = 4;
    }

    return 0;
}