I am making a Mobile phone using lpc2148 and a GSM modem SIM900. i have the code for uart1 sending n receiving data. but it does not have interrupt based read function. i want interrupt based uart1 read function. here it is my code.
#include<lpc214x.h> void Uart1Init (void) // Initialize Serial Interface { PINSEL0 |= 0x00050000; //Enable RxD1 and TxD1 U1LCR = 0x83; // 8 bits, no Parity, 1 Stop bit U1DLL = 97; // 9600 Baud Rate @ 15MHz VPB Clock U1LCR = 0x03; // DLAB = 0 } void Uart1PutCh (unsigned char ch) // Write character to Serial Port { U1THR = ch; while (!(U1LSR & 0x20)); } unsigned char Uart1GetCh (void) // Read character from Serial Port { while (!(U1LSR & 0x01)); return (U1RBR); } void Uart1PutS(unsigned char *str) //A function to send a string on UART1 { while(*str) { Uart1PutCh(*str++); } } int main(void) { }
You've got a bit of work to do yet mate.
Your main() is a bit boring.
By the way - you mention that you want interrupt-driven UART communication. Does that mean that you expect some other forum visitor to invest their time to fulfill your needs or did you just inform us of your current progress and you expect to at a later time inform us when you have managed to rewrite the code to use interrupts?
Hi.
I've got the code for you. Look in the \My Documents\LPC2128\Intaruped for the source