I'm using the LPC2129 and Keil Tools. The purpose of the code is to interrupt on the receipt of a single byte of data and assign "data" to its value. The interrupt seems to work however "data" isn't the right value. Please help, Thanks.
#include <stdio.h> /* prototype declarations for I/O functions */ #include <lpc21xx.h> /* LPC21xx definitions */ void U1ISR(void) __irq; //Declare UART1 IRQ ISR int data; int main (void) { PINSEL0 = 0x0005800A; // Enable UART1 U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */ U1DLL = 8; /* 115200 Baud Rate @ 15MHz VPB Clock */ U1LCR = 0x03; /* DLAB = 0 */ U1IER = 0x1; //Enable the RDA interrupt VICVectAddr0 = (unsigned long)U1ISR; //Set UART1 ISR Vector Address VICVectCntl0 = 0x20 | 7; //Enable Slot, Set Channel 7 VICIntEnable = 0x80; //Enable Int UART1 blah ... blah ... blah while (1) { yada ... yada ... yada } } void U1ISR(void) __irq { U1IIR |= 0x01; /* Clear Interrupt */ data = U1RBR; VICVectAddr = 0x0; /* return from interrupt */ }