예제>> 차례대로 위에서 아래로 불이 들어오고 다시 아래에서 위로 불이 들어오는 프로그램을 작성하고 테스트 하세요!!

#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)

 

int N = 0x00000001;

 

void LED_INIT(void)

{

             PIOA_OER           = N;

             PIOA_PER           = N;

             PIOA_PPUDR       = N;

}

int main(void)

{

             volatile unsigned int iCount = 0;

            

             for(;N <= 128;N *= 2)

             {

                           if(N == 128)

                           {

            

                                        for(;N >= 1;N /= 2)

                                        {

                                                     LED_INIT();

 

                                                     PIOA_CODR = N;

                                                     for(iCount=0;1000000 >= iCount; ++iCount);

 

                                                     PIOA_SODR = N;

                                                     for(iCount=0;1000000 >= iCount; ++iCount);

                                        }

 

                           }

                           LED_INIT();

 

                           PIOA_CODR = N;

                           for(iCount=0;1000000 >= iCount; ++iCount);

 

                           PIOA_SODR = N;

                           for(iCount=0;1000000 >= iCount; ++iCount);

             }

             return 0;

}


Posted by mantwo