interfacing of gsm modem with atmega 16

Status
Not open for further replies.

vishu489

Advanced Member level 4
Joined
Aug 28, 2011
Messages
116
Helped
3
Reputation
6
Reaction score
3
Trophy points
1,298
Activity points
2,120
hi i want to interface gsm modem sim 300 with atmega 16.my target is to send message and received msg from gsm modem.if any one having source code then plz mail me at vishu489@gmail.com
 

**broken link removed**

**broken link removed**

**broken link removed**

---------- Post added at 17:42 ---------- Previous post was at 17:40 ----------

sample code for gsm

Code:
#include <mega16.h>
#include <stdio.h>
#include <delay.h>
 
char Enter=13;
char double_quote=34;
char Ctrlz=26;
 
void main(void)
{
 
PORTD=0x00;
DDRD=0x00;
 
UCSRA=0x00;
UCSRB=0x18;
UCSRC=0x86;
UBRRH=0x00;
UBRRL=0x33;
 
while (1)
      { 
      
        if (PIND.2==0) {
        
          printf("at%c",Enter);
          delay_ms(500);
          
          printf("AT+CMGF=1%c",Enter);
          delay_ms(500);
          
          printf("AT+CMGS=%c09351563176%c%c",double_quote,double_quote,Enter);
          delay_ms(100);
          
          printf("AVR Test 1%c",Ctrlz);
          delay_ms(500);
          
        };
                   
       };
}
 
Reactions: MRAMA

    MRAMA

    Points: 2
    Helpful Answer Positive Rating
thank u for ur reply
but why u assign the following values
to char variables
enter=13
double quote=34
ctrlz=26
 

thank u for ur reply
but why u assign the following values
to char variables
enter=13
double quote=34
ctrlz=26

these are the ASCII representation codes based on the ASCII table
**broken link removed**
 

will u please explain me in detail
 

when you printf the specified character number the modem receives the character that this number represent in the above ASCII table
 

send code:
(atmega664p)

Code:
#include <avr/io.h> 
#define baud ((F_CPU/(speed*16UL))-1) 
#define speed 2400       // 
#define F_CPU 16000000UL    // 
#include <stdio.h> 


void usart_init()                     //(unsigned int baud) 
{ 
UBRR0H = (unsigned char) (baud>>8);  
UBRR0L = (unsigned char) baud;       // 

UCSR0B = (1<<RXEN1) | (1<<TXEN0);   

UCSR0C = (1<<USBS1) | (3<<UCSZ00); 
} 

void usart_transmit(char data) 
{ 

while ( !( UCSRA & (1<<UDRE)) ) 
UDR= data; 
} 


void send(char *data0) 
{ 
int j; 
int x=strlen(data0); 
    for(j=0;j<x;j++) 
    { 
    usart_transmit(data0[j]);  
    } 
} 

int main (void) 
{ 
usart_init(); 
   while(1) 
   { 
   send("it's me!"); 
   } 
}
 
okay that's fine but what about to receive msg & thank u


dont use this forum as your mobile, if you need any help from anyone in future... all your post will be deleted and you would get infraction or ban if continued..

take this as last warning , and spend time to type the words properly.....
 
Last edited by a moderator:

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