[SOLVED] uart interrupt for lpc2148

Status
Not open for further replies.

marthoma

Junior Member level 3
Joined
Oct 15, 2014
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
171
Sir i have completed the message sending part from sim908 to lpc 2148 using the polling method..Now i wanted to do the same with interrupts...i hd written the code for it which i have attached here buts its not working for me...i am not receiving any characters from sim908 now...
please let me know where i am gng wrong in the code.....
Code:
void USARTInit()
{
	PINSEL0 = 0x00000005;
        U0LCR   = 0x83;
 	U0DLM   = 0x00;
	U0DLL   = 0x61;
	U0FCR  = 0X07;//ENABLE FIFO	
	U0LCR   = 0x03;	U0IER   = 0x00000003;
	VICIntEnable |= ((1<<6)|(1<<7));
	VICVectCntl1 = (1<<5)|6;
	VICVectAddr1 = (unsigned int)myGSM;
}
void myGSM(void) __irq
{
	unsigned char p;
	p=U0RBR;
	if((p=='A'||p=='a')||(p=='T'||p=='t'))
	{
		U0IER=0x00;
		arr_gsm[i++]=p;
		U0IER=0x01;
	}	
		VICVectAddr = 0x00;
}
 

im using character lcd 16*2
....im now getting the interrupts well..though im not being able to extract the incoming message well to be displayed on the lcd.
 

From what it looks like,your code has two functions.The first function is for initializing USART,and the second function is the interrupt service routine for the GSM interrupt.Where in the code,are you sending/receiving the message?
 

In ISR use a 200 byte buffer to receive USART data. Don't test for AT or anything else in ISR. Every AT response ends with OK. So just receive whatever the SIM908 sends and after all the data is dumped to buffer, parse the buffer and extract the required field or SMS.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…