K7i ARM开发板源码之流水灯
/*******************************************************************************************************
* 文件名:main.c
* 功 能:流水灯
* 作 者:李园
* 日 期:2008年5月21号
* 博 客:blog.csdn.net/liyuanempire
********************************************************************************************************/
#include "config.h"
#define LED4 0xF<<16
void DelayNS(uint32 dly)
{
uint32 i;
for(;dly>0;dly--)
for(i=0;i<50000;i++);
}
const uint32 LED_TBL[]={
0x1,0x3,0x7,0xf,0xe,0xc,
0x8,0xc,0xe,0xf,0x7,0x3,
0x1,0x0,0x0,0x0,0x0,0x0,
0x9,0x9,0xf,0xf,0x9,0x9,
0x0,0x0,0x0,0x0,0x0,0x0,
0x9,0x9,0xf,0xf,0x9,0x9,
0x0,0x0,0x0,0x0,0x0,0x0
};
int main (void)
{
uint8 i;
PINSEL2=PINSEL2&(~0x08);
IO1DIR=LED4;
while(1)
{
for(i=0;i<43;i++)
{
IO1SET=~((LED_TBL[i])<<16);
DelayNS(20);
IO1CLR=~((LED_TBL[i])<<16);
DelayNS(20);
}
}
return 0