본문 바로가기
dev, tech/embedded

<img src="http://blogimgs.naver.com/nblog/ico_scrap01.gif" class="i_scrap" width="50" height="15" alt="본문스크랩" /> 실습4. Interrupt Contoller

by 구띵 2006. 7. 13.

실습4. Interrupt Contoller

- WDT 에서 인터럽트 발생하여 처리(IRQ)

 

void Isr_Init(void)
{

 

                     //1. Clear WDT Pending bit clear in INTMSK

                     //2. Clear WDT Sub pending bit clear in INTSUBMSK

                     //3. Register ISR start Address

                     rINTMSK = rINTMSK & ~(1<<9);

                     rINTSUBMSK = rINTSUBMSK & ~(1<<13);

                     pISR_WDT_AC97 = (unsigned) Wdt_Isr;

 


}

 

 

void Wdt_Init(void)
{

                    //1. Set WTCNT

                     //2. Set WTDAT

                     //3. Set WTCON

                     rWTCNT=200000/128;

                     rWTDAT=200000/128;

                     rWTCON=((PLCK/1000000)-1)<<8 | 1<<5 | 3<<3 | 1<<2;

}

 

 

 

void __irq Wdt_Isr(void)
{

                    //1. variable0 increment

                     //2. Clear pending bit in SUBSRCPND

                     //3. Clear pending bit in SRCPND

                     //4. Clear pending bit in INTPND

                    

                    // a.

                     variable0++;

                    

                    // b.

                    // bit clear

                     rSUBSRCPND = 1<<13;

                     rSRCPND = 1<<9;

                     rINTPND = 1<<9;

 

                     // 조금더 복잡한 프로그램 작성시에는 a.와 b.의 순서를 바꾸는 것이 좋다.

             

}

 

 

 

 

char ch;

ch=RdURXTH1();

추가...

 

__irq UART1_Isr(void)함수에 추가

 

댓글