Hello everyone,
I am using a wave com GSM modem to receive/send sms. I wrote a program for ATmega32 that sends AT commands like AT, AT+CMGF=1, AT+CNMI=1,2,0,0,0 it sends sms it receive too but the problem is that when i work with PC hyper terminal all things are working well. when i connect gsm modem to UART of avr to receive any incoming sms. it receives but it skips some characters in between.
The problem basically is it skips some characters while receives a message.
Plz any one help me..
Code i used is like..
#include<avr/io.h>
#include<util/delay.h>
#include<avr/interrupt.h>
#include<compat/deprecated.h>
#include<lcd.h>
unsigned int i=0;
unsigned char chunnu[160];
void uart_tx(unsigned char data)
{
while(!(UCSRA & (1<<UDRE)));
UDR=data;
}
SIGNAL(SIG_UART_RECV)
{
chunnu[i++]=UDR;
lcd_data(chunnu[i]);
//i=i+1;
}
void uart_puts( char *s)
{
while(*s)
uart_tx(*s++);
}
int main(void)
{unsigned int j=0,k=0;
//unsigned char temp=0;
DDRB=0xFF;
DDRD=0xF0;
PORTB=0x00;
PORTD=0xFF;
lcd_init();
sei();
UCSRA=0;
UCSRB=(1<<TXEN)|(1<<RXEN)|(1<<RXCIE);
UCSRC=1<<URSEL | 1<<UCSZ1 | 1<<UCSZ0; // 8 data bit, a stop, none parity
UBRRH=0;
UBRRL=103; // for 9600 baud at 16MHz
cbi(UCSRA,7);
uart_puts("at");
uart_tx(0x0D); // enter after AT
_delay_ms(2000);
uart_puts("at+cmgf=1");
uart_tx(0x0D); // enter after AT+CMGF=1
_delay_ms(1000);
uart_puts("at+cnmi=1,2,0,0,0"); // Auto recive incoming sms
uart_tx(0x0D); // enter after AT+CNMI
lcd_cmd(0x01);
_delay_ms(1000);
i=0;
lcd_cmd(0x01);
while(1==1)
{
}
}
return 0;
}