Thanx alot my bro for helping... But yeah I am in REALLY hurry its LAST WEEK for submition. I am still stuck on how would I make an LED Light up by SMS. My Modem does communicate with MCU with responding to AT commands and indicating other LED lights. But I need to make it READ SMS in such a way for example I send a number "1" to modem so that then it turns on LED 1 on LED board. Can you or anyone PLEASE just give an idea if someone has done something alike..... THANKS SO ALOT IN ADVANCE. Heres my code:
#include "LCDdrive.h"
char uart_rd;
char output;
void main() {
LCD_initialise();
UART1_Init(9600); // Initialize UART module at 9600 bps
Delay_ms(100); // Wait for UART module to stabilize
TRISD=0x00;
TRISC6_bit = 0;
TRISC7_bit = 1;
//PORTC=0;
PORTD=0;
// U1MODEbits.ALTIO = 1; // un-comment this line to have Rx and Tx pins on their alternate
// locations. This is used to free the pins for other module, namely the SPI.
UART1_Write_Text("AT");
UART1_Write(10);
UART1_Write(13);
UART1_Read(); // read the received data,
UART1_Read_Text(output, "OK", 10); // reads text until 'OK' is found
UART1_Write_Text(output); // sends back text
PORTD=0x01;
LCD_putch(output); // Print the character. It can show a character or string typed in Send window on Receive window and LCD
UART1_Write_Text("AT+CMGF=1");
UART1_Write(10);
UART1_Write(13);
UART1_Read(); // read the received data,
UART1_Read_Text(output, "OK", 10); // reads text until 'OK' is found
UART1_Write_Text(output); // sends back text
PORTD=0x02;
LCD_putch(output); // Print the character. It can show a character or string typed in Send window on Receive window and LCD
UART1_Write_Text("AT+CMGD=1");
UART1_Write(10);
UART1_Write(13);
UART1_Read(); // read the received data,
UART1_Read_Text(output, "OK", 10); // reads text until 'OK' is found
UART1_Write_Text(output); // sends back text
PORTD=0x04;
LCD_putch(output); // Print the character. It can show a character or string typed in Send window on Receive window and LCD
UART1_Write_Text("AT+CMGR=1");
UART1_Write(10);
UART1_Write(13);
UART1_Read();
while (1) { // Endless loop
if (UART1_Data_Ready()) { // If data is received,
uart_rd = UART1_Read(); // read the received data,
UART1_Write(uart_rd); // and send data via UART
PORTD=0xFF;
LCD_putch(uart_rd); // Print the character. It can show a character or string typed in Send window on Receive window and LCD
}
}
}
#include"LCDdrive877A.c"