Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

send and receive sms using sim900A interface ATmega128A

Status
Not open for further replies.

theanilkumargupta

Newbie level 2
Joined
May 2, 2013
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,303
Hello Friend,

I am working send and receive sms using SIM900A and Atmega128A. I am able to send sms using program but i am not receive sms and display on LCD.
I am using WINAVR and peterfleury Lib. Please Help.

//************************************************************************//
//********************* Recive SMS Using SIM900A Module **********************//
//***************************************************************************//
#include <avr/io.h>
#include <avr/interrupt.h>
#include <stdlib.h>
#include "uart.h" // peterfleury Lib
#include "lcd.h" // peterfleury Lib
#include <util/delay.h>

#define UART_BAUD_RATE 9600 /* 9600 baud */
#define xtalCpu 7372800L

int i;
char x;
int k,i;
char data[256];
char j;
char msg[15];
char store[]="Hi anil";
char ch;

int main(void)
{
lcd_init(LCD_DISP_ON); // Initialize LCD
uart_init( UART_BAUD_SELECT(UART_BAUD_RATE,F_CPU) );
sei();
//DDRA = 0xFF;
//PORTD=0x00;
while(1)
{
for(i=0;i<=50;i++)
{
_delay_ms(200);
if(i==50)
{
uart_puts("AT\r\n");
_delay_ms(2000);
uart_puts("AT+CMGF=1\r\n");//Message format “AT+CMGF=[mode]1”
_delay_ms(2000);
uart_puts(" AT+CMGR=1\r"); //Reads the first SMS
_delay_ms(20);
uart_puts("AT+CNMI=1,2,0,0,0\r\n");
//_delay_ms(20);

while((ch=uart_getc( )) !='\n')
{
msg[i++]=ch;
msg='\0';
//i=0;
}

//while(msg!='\0')
//{
// putc(msg[i++]);
//}

if(store!=msg[8])
{

lcd_puts("NO");
_delay_ms(200);
}
if(store==msg[8])
{

lcd_puts("yes");
_delay_ms(200);
}

//lcd_clrscr();
//uart_puts("AT+CMGDA=\"DEL ALL\"\r\n");
//_delay_ms(2000);
}
}


}
}
 

use reading message using at+cmgr=1; and then give delay of 2000ms recieve message using interrupt and after that delete message using at+cmgda="dell all" coomand.
 

use reading message using at+cmgr=1; and then give delay of 2000ms recieve message using interrupt and after that delete message using at+cmgda="dell all" coomand.

Please give some link to use interrupt.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top