Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Receiving PUi5 from GSM modem

Status
Not open for further replies.

mvpradeepemb

Newbie level 1
Joined
Nov 16, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
Dear All,

I am interfacing Atmega16 with GSM modem(SIM900). Modem works fine with hyperterminal. Controller also transmits and receives good with hyper terminal. But when i interface controller with gsm, i receive "PU8" and "PUi5" when i transmit "AT" & "AT+CFGM=1".

Code:
int main(void)
{
        init();
        lcd_init();
        sei();
        set_timer2();
        ptr=gett;
        usart_init(myubrr);
        step=0;
   
       command(0x01);
       command(0x80);
 
    while(1)
     {



        if (!(PINA & (1<<PINA0)))
                   {
            
                command(0x01);
                command(0x80);     
       if(step==0)
              {
               step=1;
               usart_transmit('A');
               delay(100);
               usart_transmit('T');
               delay(100);
               usart_transmit(13);
              }
       }
               
 if (!(PINA & (1<<PINA1)))
                   {
            
                command(0x01);
                command(0x80);     
        if(step==1)
                {
                 step=2;
                 usart_transmit('A');
                 delay(50);
                 usart_transmit('T');
                 delay(50);
                 usart_transmit('+');
                 delay(50);
                 usart_transmit('C');
                 delay(50);
                 usart_transmit('M');
                 delay(50);
                 usart_transmit('G');
                 delay(50);
                 usart_transmit('F');
                 delay(50);
                  usart_transmit('=');
                 delay(50);
                 usart_transmit('1');
                 delay(50);
                usart_transmit(13);
             
               }
            }
             


   }


}



void init(void)
{

 

  DDRB=0xFF;
  PORTB=0xFF;

 
  PORTC=0xFF;
  DDRC=0xFF;

  DDRA=0x00;
  PORTA=0xFF;

  PORTD=0x00;
  DDRD=0x3C;


}

void delay(const long del)
 {
  long x;
  int y,z;
  for(x=0;x<=del;x++)
   {
     for(y=0;y<=254;y++)
     for(z=0;z<=254;z++);
   }
  return;
 }

void USART_Flush( void )
{
   unsigned char dummy;
   while ( UCSRA & (1<<RXC) ) dummy = UDR;
}

void usart_init(unsigned int ubrr)
{

 UBRRH=(unsigned char)(ubrr>>8);
 UBRRL=(unsigned char)ubrr;
 UCSRB=(1<<RXEN)|(1<<TXEN)|(1<<RXCIE);
 UCSRC = (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); //(1 << URSEL) }

}

void usart_transmit(unsigned char datat)
{
 
  while(!(UCSRA & (1<<UDRE)));
  UDR=datat;
 
}

//unsigned char usart_receiver(void)

ISR(USART_RXC_vect)
{



    rec=UDR;
    display(rec);



}
I also tested using vb6. I transmit chr(10) + chr(13) + "OK" + chr(13) + chr(10) from vb6. I receive $$OK$$ in MCU. But i do know why i am receive PU8 and PUi5 in MCU.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top