Unable to use sim300 gsm modem!!

Status
Not open for further replies.

narsingh123

Newbie level 2
Joined
May 7, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
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!!!
 

Search here, you will find lot of threads going on about receiving sms.

On a quick look i noticed a few things.

1. Echo is ON. you have to switch off echo or else you will need lot of memory.
2.
unsigned char GSM_BUFF[20]; //declare receive buffer
I think it is not enough.
3.
unsigned char* GSM_MSG3 = "AT+CMGR=5\r\n";
You will always read the sms which is stored in the fifth position, is it correct
 
Thank u ....
i was just tryiing to read the sms of 5th index.... can you please send me some related programs from which i can get guidance?? my email: narsinghcool@gmail.com
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…