narsingh123
Newbie level 2

Sir, i m intended to send AT commands to SIM300 GSM Modem thru ATMEGA16 microcontroller using USART.
I need to read the sms stored in the sim card.
Can any 1 guide me in this regard??
I m connecting TX of uC to RX of modem n vice versa.
I am using this code for sending commands:
#include<avr/io.h>
#include<util/delay.h>
// Standard Input/Output functions
#include <stdio.h>
#include "string.h"
#include "lcd.h"
#include "init.h"
#include "usart8535.h"
// Declare your global variables here
unsigned char* GSM_MSG1= "AT+CGSN";
unsigned char GSM_BUFF[20]; //declare receive buffer
unsigned char Receive; //used for receiving
const unsigned char Delimiter = 13; //here you define the delimiter
#define CONTROL_Z 0x1A
#define Enter 0x0D
unsigned char* GSM_MSG2 = "AT+CMGF=1\r\n";
unsigned char* GSM_MSG3 = "AT+CMGR=5\r\n";
//unsigned char* GSM_MSG4 = "Testing 123 this missage is sent: ";
int main(void)
{ // unsigned char a,b;
// Declare your local variables here
initport();
initusart();
delay_ms(1000);
lcd_init();
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
//count=(-1);
lcd_string("READY");
delay_ms(1000);
while(1)
{
usart_puts(GSM_MSG1);
USART_Transmit(0x0a);
USART_Transmit(0x0d);
//lcd_cmd(0x01);
lcd_string(GSM_MSG1);
delay_ms(1000);
//lcd_cmd(0x01);
Receive=USART_Receive();
lcd_cmd(0xc0);
lcd_char(Receive);
}
return 0;
}
plzzzzzzzz help me out!!!
I need to read the sms stored in the sim card.
Can any 1 guide me in this regard??
I m connecting TX of uC to RX of modem n vice versa.
I am using this code for sending commands:
#include<avr/io.h>
#include<util/delay.h>
// Standard Input/Output functions
#include <stdio.h>
#include "string.h"
#include "lcd.h"
#include "init.h"
#include "usart8535.h"
// Declare your global variables here
unsigned char* GSM_MSG1= "AT+CGSN";
unsigned char GSM_BUFF[20]; //declare receive buffer
unsigned char Receive; //used for receiving
const unsigned char Delimiter = 13; //here you define the delimiter
#define CONTROL_Z 0x1A
#define Enter 0x0D
unsigned char* GSM_MSG2 = "AT+CMGF=1\r\n";
unsigned char* GSM_MSG3 = "AT+CMGR=5\r\n";
//unsigned char* GSM_MSG4 = "Testing 123 this missage is sent: ";
int main(void)
{ // unsigned char a,b;
// Declare your local variables here
initport();
initusart();
delay_ms(1000);
lcd_init();
delay_ms(100);
delay_ms(100);
delay_ms(100);
delay_ms(100);
//count=(-1);
lcd_string("READY");
delay_ms(1000);
while(1)
{
usart_puts(GSM_MSG1);
USART_Transmit(0x0a);
USART_Transmit(0x0d);
//lcd_cmd(0x01);
lcd_string(GSM_MSG1);
delay_ms(1000);
//lcd_cmd(0x01);
Receive=USART_Receive();
lcd_cmd(0xc0);
lcd_char(Receive);
}
return 0;
}
plzzzzzzzz help me out!!!