Microcontroller › AVR › How to interface GSM modem TO atmega16
- This topic has 11 replies, 7 voices, and was last updated 8 years, 10 months ago by divya.
-
AuthorPosts
-
February 22, 2011 at 7:21 pm #743hardeepParticipant
Sir i wanted to interface GSM modem SIM300 to Atmega16…i want to communicate both the ways…please help me out with the coding and the code explanation….I am using Code vision avr for writing the program…
Thanks in advance sir…!!!
February 23, 2011 at 6:17 am #5592dagakshayParticipantyou can get the help from here its on 8051 but you can convert it into AVR
March 29, 2011 at 5:07 pm #5837hardeepParticipantI am not getting how to interface it with ATMEGA16…plz help me with the coding part…!!!
How to send the string to the modem using usart and all…
Individually my usart is running fine and GSM modem also running fine…but i m not able to interface modem to atmega16…!!!
March 31, 2011 at 5:11 am #5844dagakshayParticipantthe links i have posted above shows how to interface gsm modem to 8051…
let us know where exactly you got struct… are asking for algo???
March 31, 2011 at 2:03 pm #5846hardeepParticipantMy GSM modem and AVR usart are working fine individually….but when i connect modem to controller,i
#include<avr/io.h>#include<util/delay.h>#define F_CPU 11059200UL#define USART_BAUDRATE 9600 // Baud Rate value#define BAUD_PRESCALE (((F_CPU / (USART_BAUDRATE * 16UL))) – 1)#define LCD_DATA PORTB //LCD data port#define ctrl PORTD#define en PD2 // enable signal#define rw PD3 // read/write signal#define rs PD4 // register select signalvoid usart_putstr(char * s);void LCD_cmd(unsigned char cmd);void init_LCD(void);void LCD_write(unsigned char data);void usart_init();static void usart_putch(unsigned char send);unsigned int usart_getch();void gotoxy(unsigned char row,unsigned char column);static void LCD_String(char *s);int main(){unsigned char value,i;DDRB=0xff; // LCD_DATA port as output portPORTB=0x00;DDRD|=0xFC;init_LCD(); //initialization of LCD_delay_ms(50); // delay of 50 milli secondsusart_init(); // initialization of USARTgotoxy(1,1);//char a[] = “AT”;char b[] = “AT+CMGS=”;char no[]=”+919595955635″;char body[] = “Successful”;{//usart_putstr(a);//_delay_ms(5);// usart_putstr(“rn”);// _delay_ms(100);usart_putstr(b);_delay_ms(100);usart_putch(‘”‘);// _delay_ms(100);usart_putstr(no);// _delay_ms(100);usart_putch(‘”‘);_delay_ms(100);usart_putch(‘r’);usart_putch(‘n’);_delay_ms(100);usart_putstr(body);_delay_ms(100);usart_putch(0x1A);// for (i=0;i<16;i++)// {// value=usart_getch(); // Call a function to get data from serial port// _delay_ms(100);// LCD_write(value); // write data to LCD// }// gotoxy(2,1);}return 0;}void init_LCD(void){LCD_cmd(0x38); // initialization of 16X2 LCD in 8bit mode_delay_ms(1);LCD_cmd(0x01); // clear LCD_delay_ms(1);LCD_cmd(0x0E); // cursor ON_delay_ms(1);LCD_cmd(0x80); // —8 go to first line and –0 is for 0th position_delay_ms(1);return;}void LCD_cmd(unsigned char cmd){LCD_DATA=cmd;ctrl &=~ (1<<rs);ctrl&=~(1<<rw);ctrl|=(1<<en); // RS and RW as LOW and EN as HIGH_delay_ms(1);ctrl &=~ (1<<rs);ctrl&=~(1<<rw);ctrl&=~(1<<en); // RS, RW , LOW and EN as LOW_delay_ms(1);return;}void LCD_write(unsigned char data){LCD_DATA= data;ctrl |= (1<<rs);ctrl&=~(1<<rw);ctrl|=(1<<en); // RW as LOW and RS, EN as HIGH_delay_ms(1);ctrl |= (1<<rs);ctrl&=~(1<<rw);ctrl&=~(1<<en); // EN and RW as LOW and RS HIGH_delay_ms(1); // delay to get things executed return ;}void usart_init(){UBRRL = 0x47;// UBRRL = (unsigned char)BAUD_PRESCALE;// Load lower 8-bits of the baud rate value into the low byte of the UBRR register// UBRRH = (unsigned char)(BAUD_PRESCALE>>; // Load upper 8-bits of the baud rate value.._delay_ms(1);UCSRB |= (1 << RXEN) | (1 << TXEN); // Turn on the transmission and reception circuitryUCSRC |= (1 << URSEL) | (1<<USBS) | (1 << UCSZ0) | (1 << UCSZ1);// Use 8-bit character sizes}unsigned int usart_getch(){while (!(UCSRA & (1 << RXC)) );// Do nothing until data has been received and is ready to be read from UDR_delay_ms(1);return(UDR); // return the byte}static void usart_putch(unsigned char send){while ((UCSRA & (1 << UDRE)) == 0); // Do nothing until UDR is ready..// for more data to be written to itUDR = send; // Send the byte}void gotoxy(unsigned char row,unsigned char column){switch (row){case 1: LCD_cmd (0x80 + column – 1); break;case 2: LCD_cmd (0xc0 + column – 1); break;default: break;}}static void LCD_String(char *s){register char c;while((c = *s++)){_delay_ms(10);LCD_write(c);}return;}void usart_putstr(char * s){while(*s){usart_putch(*s++);}}am not receiving messages…
April 3, 2011 at 5:25 pm #5867hardeepParticipantCan anyone help me out with the programming logic ???
May 18, 2011 at 11:38 am #6271saahil agrawalParticipantSir,
i want to interface a sim900 with atmega16 using serial communication and i want the at,ega tp check in specific time interval whether there is any message in the inbox of the module and if yes i want to ddecode it accordingly. also i muxt be able to send sms.
thanking in advamce and i am eagerly waiting for the solution as i am nearimg the deadline of my project submission.
August 19, 2011 at 11:48 am #6613rezaParticipanthi
i think this program is betet 4 u .
i did it .this program is working with pc (in codevision terminal )but it doesnt work with gsm 300!!!
#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);};};}August 19, 2011 at 12:04 pm #6612rezaParticipantNovember 1, 2012 at 5:43 am #87075HUJ4ParticipantBy using GSM SIM300M Module & Atmega8 Uc ,How to send SMS to 3 Different persons when one of the port pin of Atmega8 gets high … Plzz some body help me in dis regard for “coding part” ….!!!!
July 22, 2014 at 7:26 am #11918HARESHParticipanthow to intreface gsm modem to avr microcontroller…..?
please take it source code with programing …type instolll ….
March 9, 2016 at 4:42 am #13770divyaParticipantsir, i want a code to interface gps and gsm module with avr(atmega16) in MIKRO C.I am using GPS6MV2 module and GSM SIM900A. i want to receive the gps data(latitude and longitude values) through UART and display it on LCD.
-
AuthorPosts
- You must be logged in to reply to this topic.