embedtronics
Newbie level 4
- Joined
- Mar 24, 2013
- Messages
- 5
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,313
Hello everyone,
I need a code for LPC2138 to run UART with interrupt. I have pasted my code below. I am switching on an LED inside the interrupt if '1' is received. But the led constantly stays on and that too its dim with a voltage of 3.3V across it. Please help!!
I need a code for LPC2138 to run UART with interrupt. I have pasted my code below. I am switching on an LED inside the interrupt if '1' is received. But the led constantly stays on and that too its dim with a voltage of 3.3V across it. Please help!!
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 #include<lpc21xx.h> __irq void UART0_ISR(void); int main() { PINSEL0 = 0x05; U0LCR = 0x83; U0DLL = 124; U0LCR = 0x03; U0IER = 0x01; IODIR0 = 0x00000010; IOCLR0 = 0x00000010; VICVectAddr0 = (unsigned int)UART0_ISR; VICVectCntl0 = 0x20|6; VICIntEnable = 0x00000040; while(1) { } } __irq void UART0_ISR(void) { if((U0IIR & 0x04)==0x04) { if(U0RBR == '1') IOSET0 = 0x00000010; else IOCLR0 = 0x00000010; } VICVectAddr = 0; }
Last edited by a moderator: