//LED 1~8번까지 순차적으로 불깜빡거리기(LOW(CODR) 신호가 들어가면 LED는 off되고 반대로 HIGH(SODR)신호가 들어가면 on)
#define PIOA_PER (*(volatile unsigned int *)0xFFFFF400)
#define PIOA_OER (*(volatile unsigned int *)0xFFFFF410)
#define PIOA_PPUDR (*(volatile unsigned int *)0xFFFFF460)
#define PIOA_CODR (*(volatile unsigned int *)0xFFFFF434)
#define PIOA_SODR (*(volatile unsigned int *)0xFFFFF430)
#define PIOA_PER (*(volatile unsigned int *)0xFFFFF400)
#define PIOA_OER (*(volatile unsigned int *)0xFFFFF410)
#define PIOA_PPUDR (*(volatile unsigned int *)0xFFFFF460)
#define PIOA_CODR (*(volatile unsigned int *)0xFFFFF434)
#define PIOA_SODR (*(volatile unsigned int *)0xFFFFF430)
void LED_INIT(void)
{
// Configure the pin in output
PIOA_OER = 0x00000000; //처음에 불이 꺼진 상태에서 시작
// Set the PIO controller in PIO mode instead of peripheral mode
PIOA_PER = 0x000000FF;
// Disable pull-up
PIOA_PPUDR = 0x000000FF;
}
int main(void)
{
volatile unsigned int iCount = 0;
int iCnt;
{
volatile unsigned int iCount = 0;
int iCnt;
LED_INIT();
while (1)
{
for(iCnt=0; iCnt<8; ++iCnt)
{
PIOA_OER = 0x00000001 << iCnt; //1번부터 켜짐
PIOA_CODR = 0x00000001 << iCnt;
for(iCount=0;1000000 >= iCount; ++iCount);
{
for(iCnt=0; iCnt<8; ++iCnt)
{
PIOA_OER = 0x00000001 << iCnt; //1번부터 켜짐
PIOA_CODR = 0x00000001 << iCnt;
for(iCount=0;1000000 >= iCount; ++iCount);
PIOA_SODR = 0x000000FF;
for(iCount=0;1000000 >= iCount; ++iCount);
}
}
return 0;
}
for(iCount=0;1000000 >= iCount; ++iCount);
}
}
return 0;
}
'디지털회로 > AT91SAM7S256' 카테고리의 다른 글
한글입력하기 (0) | 2011.09.06 |
---|---|
AT91SAM7S256을 이용한 UART 통신설정 (0) | 2011.09.06 |
AT91SAM7S256 실행순서 (0) | 2011.06.21 |
ARM-SAM7S (0) | 2011.06.20 |
Eflag 레지스터 구조 (0) | 2011.06.20 |