Microcontroller › PIC › problem in receving message with pic16f877a
- This topic has 11 replies, 3 voices, and was last updated 10 years, 9 months ago by kittythakur.
Viewing 12 posts - 1 through 12 (of 12 total)
-
AuthorPosts
-
December 28, 2013 at 9:56 am #2782kittythakurParticipant
heelo guys …. i m making project to switch on and off led by sms….i m using p16f877a with sim900a modem
i m able to send message from modem to mobile but i m getting problem while receiving text
i m using AT+CMGR=1
and getting +CMGR: “REC READ”,”+917696897725″,,”12/07/22,14:24:11+22″
#a1
i want to extract #a1 from the string and rest string i want to skip
i apllied various logic but did’t get right output
here is my code
if(UART1_Data_Ready()>0){inchar=UART1_Read();i++;delay_ms(10);if (inchar==’#’){i++;if(inchar==’o)’{i++;if(inchar==’n’){led=1;}else if (inchar==’f’){led=0;}}}else {led=0;Tx();delay_ms(10);inchar=UART1_Read();UART1_Write_Text(“AT+CMGD=1,4”);UART1_Write(0x0D); }}can anybody correct my code ????December 28, 2013 at 1:20 pm #10769AJISH ALFREDParticipantHi,
Put that piece of code inside the infinite loop
while (1)
{
/////// code /////
}
December 30, 2013 at 4:42 am #10786kittythakurParticipantThanks for reply
actaully i apllied this code in infinite loop …you can check this
while(1){ UART1_Init(9600);delay_ms(500);UART1_Write_Text(“ATeo”);UART1_Write(0x0D);delay_ms(300);UART1_Write_Text(“AT+CMGF=1”);UART1_Write(0x0D);delay_ms(300);UART1_Write_Text(“AT+CNMI=2,2,0,0” );UART1_Write(0x0D);delay_ms(300) ;UART1_Write_Text(“AT+CMGR=1”) ;UART1_Write(0x0D);delay_ms(300);led1=1 ;if(UART1_Data_Ready()>0){while (UART1_Read()==’