rtoribio
Newbie level 2
hello freinds,
I am using LPC2136 on MDK-lite v-5.25 with legacy pluggins to run ARM7TDMI, but i dont know why this code is not working with interrupt on UART0 __irq this can not TX0 and RX0.
here all my funtions and codes:
I am using LPC2136 on MDK-lite v-5.25 with legacy pluggins to run ARM7TDMI, but i dont know why this code is not working with interrupt on UART0 __irq this can not TX0 and RX0.
here all my funtions and codes:
Code C - [expand] 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 #include "LPC213X.h" #include <stdint.h> #include "ST7735.h" extern void initPLL(void); extern void SPI_init(void); extern void Serial0_init(void); extern const uint16_t Logo[]; //Imagen logo utesa. extern void UART0_Interrupt_EN(void); extern void init_gpiox(void); __irq void UART0Handler (void); void delay(void); char rxdat; int main(void) { int x, y, dx, dy; init_PLL(); SPI_init(); Serial0_init(); init_gpiox(); UART0_Interrupt_EN(); while(1); U0THR= 'A'; U0THR= 'B'; IO0SET |= 0x00000080; delay(); IO0CLR |= 0x00000080; ST7735_FillScreen(0xFFFF); // set screen to white x = 15; //44 y = 130; //159 dx = 1; dy = 0; while(1){ //ST7735_DrawBitmap(x, y, Logo, 40, 160); ST7735_DrawBitmap(x, y, Logo, 96, 96); x = x + dx; y = y + dy; if((x >= (ST7735_TFTWIDTH - 40 + 15)) || (x <= -15)){ dx = -1*dx; } if((y >= (ST7735_TFTHEIGHT + 8)) || (y <= (ST7735_TFTHEIGHT - 8))){ dy = -1*dy; } } // while(1); } __irq void UART0Handler (void) { rxdat = U0RBR; VICVectAddr= 0x00000000; IO0SET |= 0x00000080; delay(); IO0CLR |= 0x00000080; } void delay(void) { uint32_t i; for(i=0;i<=320000;i++); } ------------------------------------------------------------------------------------ void Serial0_init(void) { PINSEL0=0x00050000; //Habilitar TDX0 RDX0. U0FCR=0x01; U0LCR=0x00000083; //8bits, no paridad y bit de stop. U0DLL=85; //Velocidad de puerto serial 9600 baudios. U0DLM=0x0; U0FDR= 0x0000005E; // MULVAL = 0x5 and DIVADDVAL = 14 U0LCR= 0x00000003; //DLAB = 0. U0IER= 0x00000003; //Interrupciones habilitadas en el puerto serial 0. } ------------------------------------------------------------------------------------- extern __irq void UART0Handler (void); void UART0_Interrupt_EN(void) { VICIntSelect = 0x00000000; VICVectAddr0 = (unsigned int) UART0Handler; //Vector 0 para la interrupcion serial VICVectCntl0 = 0x26; //select UART0 interrupt as IRQ i.e vector 0 VICIntEnable = 0x00000040; }
Last edited by a moderator: