init.s源程序
AREA init, CODE,READONLY
CODE32
ENTRY
resetentry
IMPORT main
LDR SP,=0x33ff0000
bl main
end
flashled.c 源程序
#define rGPFCON (*(volatile unsigned *)0x56000050)
#define rGPFDAT (*(volatile unsigned *)0x56000054)
#define uint32 unsigned int
#define rLED1 (1<<4)
#define rLED1 (1<<4)
#define rLED2 (1<<5)
#define rLED3 (1<<6)
#define rLED4 (1<<7)
#define LED1ON rGPFDAT="rGPFDAT|rLED1"
#define LED2ON rGPFDAT="rGPFDAT|rLED2"
#define LED3ON rGPFDAT="rGPFDAT|rLED3"
#define LED4ON rGPFDAT="rGPFDAT|rLED4"
#define LED1CLR rGPFDAT="rGPFDAT"&(~rLED1)
#define LED2CLR rGPFDAT="rGPFDAT"&(~rLED2)
#define LED3CLR rGPFDAT="rGPFDAT"&(~rLED3)
#define LED4CLR rGPFDAT="rGPFDAT"&(~rLED4)
void delay(uint32 dly)
{
uint32 i,j;
for(j=dly;j>0;j--)
for(i=5000;i>0;i--);
}
int main(void)
{rGPFCON=(rGPFCON|0x00ff)|(1<<8)|(1<<10)|(1<<12)|(1<<14);
//rGPFCON=(rGPFCON|0x00ff)|0x5500;//将GPF[7:4]设置为输出。功能相似于AVR中的DDRX,DDRX是设置为1为输出,0为输入,而S3C2410每个管脚有两个位控制
while(1)
{
LED1ON;
delay(10);
LED1CLR;
delay(10);
LED2ON;
delay(10);
LED2CLR;
delay(10);
LED3ON;
delay(10);
LED3CLR;
delay(10);
LED4ON;
delay(10);
LED4CLR;
delay(10);
}
return(0);
}
设置是RO=0X0,经下载测试,程序可以运行。
文章评论(0条评论)
登录后参与讨论