■Key Interrupt■
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | #if EXAMPLE == 350 #define pISR_EINT2 (*(unsigned *)(0x33ffff28)) #define pISR_EINT3 (*(unsigned *)(0x33ffff2c)) #define pISR_EINT4_7 (*(unsigned *)(0x33ffff30)) static void EINT2_ISR(void) { rINTMSK1 |=(0xf<<2); //init submask 4~8 rEINTMASK |=(0x1f<<4); //init padding 2~8 rSRCPND1 |= (0xf <<2); rINTPND1 |= (0xf <<2); //init padding 4~8 rEINTPEND |= (0x1f <<4); Uart_Send_String("EINT2 .. !!\n\n"); rINTMSK1 &=~(0xf<<2); rEINTMASK &=~(0x1f<<4); } static void EINT3_ISR(void) { rINTMSK1 |=(0xf<<2); //init submask 4~8 rEINTMASK |=(0x1f<<4); //init padding 2~8 rSRCPND1 |= (0xf <<2); rINTPND1 |= (0xf <<2); //init padding 4~8 rEINTPEND |= (0x1f <<4); Uart_Send_String("EINT3 .. !!\n\n"); rINTMSK1 &=~(0xf<<2); rEINTMASK &=~(0x1f<<4); } static void EINT4_7_ISR(void) { if(rEINTPEND&(1<<4)){ rINTMSK1 |=(0xf<<2); rEINTMASK |=(0x1f<<4); rSRCPND1 |= (0xf <<2); rINTPND1 |= (0xf <<2); rEINTPEND |= (0x1f <<4); Uart_Send_String("EINT4 .. !!\n\n"); rINTMSK1 &=~(0xf<<2); rEINTMASK &=~(0x1f<<4); } else if(rEINTPEND&(1<<5)){ rINTMSK1 |=(0xf<<2); rEINTMASK |=(0x1f<<4); rSRCPND1 |= (0xf <<2); rINTPND1 |= (0xf <<2); rEINTPEND |= (0x1f <<4); Uart_Send_String("EINT5 .. !!\n\n"); rINTMSK1 &=~(0xf<<2); rEINTMASK &=~(0x1f<<4); } else if(rEINTPEND&(1<<6)){ rINTMSK1 |=(0xf<<2); rEINTMASK |=(0x1f<<4); rSRCPND1 |= (0xf <<2); rINTPND1 |= (0xf <<2); rEINTPEND |= (0x1f <<4); Uart_Send_String("EINT6 .. !!\n\n"); rINTMSK1 &=~(0xf<<2); rEINTMASK &=~(0x1f<<4); } } void Main(void) { //init eint[n] mode(2~6 , 7) rGPFCON &= ~(0xfff <<4); rGPFCON |= (0x6aa <<4); rGPFDAT &= ~(0xff); //init gpgcon0 rGPGCON &= ~(0x3); rGPGCON |= (0x1); //EXTINT falling edge triggered rEXTINT0 &= ~(0xffffff <<8); rEXTINT0 |= (0x2 <<8); rEXTINT0 |= (0x2 <<12); rEXTINT0 |= (0x2 <<16); rEXTINT0 |= (0x2 <<20); rEXTINT0 |= (0x2 <<24); rEXTINT0 |= (0x2 <<28); pISR_EINT2 = (unsigned int)EINT2_ISR; pISR_EINT3 = (unsigned int)EINT3_ISR; pISR_EINT4_7 = (unsigned int)EINT4_7_ISR; //init mask 2~8 rINTMSK1 &=~(0xf<<2); } # endif | cs |
■Uart Interrupt■
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #if EXAMPLE == 340 #define pISR_UART1 (*(unsigned *)(0x33ffff7c)) void UART_ISR() { unsigned char ch ; rINTMSK1 |=(1<<23); rINTSUBMSK |= (0x5 <<3); rSUBSRCPND |=(1<<3); rSRCPND1|=(1<<23); rINTPND1 |=(1<<23); rINTMSK1 &=~(1<<23); Uart_Send_String("Uart Chracter Receive Ok .. !!\n"); Uart_Printf("intput data : %d\n",RdURXH1()); rINTSUBMSK &= ~(0x5 <<3); } void Main(void) { rINTSUBMSK &= ~(0x5 <<3); rINTMSK1 &=~(1<<23); Uart_Init(115200); /*Uart_Send_Byte('\n'); Uart_Send_Byte('A'); Uart_Send_String("##Start \n");*/ pISR_UART1 = (unsigned int)UART_ISR; } # endif | cs |
'ARM Device' 카테고리의 다른 글
[ARM 디바이스 제어_Day6~10]Mini_project-무한의 계단 게임 (0) | 2018.11.23 |
---|---|
[ARM 디바이스 제어_Day5]Touch Screen (0) | 2018.11.18 |
[ARM 디바이스 제어_Day4]DMA+Timer,DMA+Uart (0) | 2018.11.18 |
[ARM 디바이스 제어_Day3]DMA (0) | 2018.11.18 |
[ARM 디바이스 제어_Day1]Timer (0) | 2018.11.18 |