-1

I have got a sim900 module which has a rs232 serial port. when I connect it to my computer it works fine on a terminal but when I connect it to an atmega16 micro controller it only echoes back what ever I send to it and does not answer to commands. besides i use a max232 ic to convert rs232 to ttl.

#include <io.h>
#include <mega16a.h>
#include <alcd.h>
#include <delay.h>
#include <stdio.h>



interrupt [USART_RXC] void usart_rx_isr(void)
{
   char status,data;
   status=UCSRA;
   data=UDR;

   if(data!=0xd && data!= 0xa)lcd_putchar(data);

}




void main(void)
{
////////////////////////I/O REGISTERS
DDRB = 1 << DDB0;

///////////////////////USART REGISTERS
UCSRA=(0<<RXC) | (0<<TXC) | (0<<UDRE) | (0<<FE) | (0<<DOR) | (0<<UPE) |      (0<<U2X) | (0<<MPCM);
UCSRB=(1<<RXCIE) | (0<<TXCIE) | (0<<UDRIE) | (1<<RXEN) | (1<<TXEN) | (0<<UCSZ2) | (0<<RXB8) | (0<<TXB8);
UCSRC=(1<<URSEL) | (0<<UMSEL) | (0<<UPM1) | (0<<UPM0) | (0<<USBS) | (1<<UCSZ1) | (1<<UCSZ0) | (0<<UCPOL);
UBRRH=0x00;
UBRRL=0x33;


///////////////////////ENABLE GLOBAL INTERUPTS
#asm("sei")
///////////////////////LCD CONFIGURATION
lcd_init(16);
lcd_gotoxy(0,0);
delay_ms(2000); 
printf("ATE0\r\n");
delay_ms(2000);
printf("ATD+989190077175;\r\n");   
delay_ms(20000);
while (1)
{   

    lcd_clear();           
    lcd_gotoxy(0,0);
    // Please write your application code here
    printf("AT\r\n");    

    delay_ms(2000);

 }

}

mohammad
  • 1
  • 1
  • *"besides i use a max232 ic to convert rs232 to ttl."* -- That adds another set of connections to to swap RxD and TxD lines. What have you done to verify the proper connections? Have you verified that this adapter is getting the proper power? – sawdust Aug 07 '16 at 23:04

1 Answers1

0

You are obviously not talking to your SIM900. The command "ATE0" you are issuing, is supposed to make SIM900 to switch the echo off. So, after that command you can't see echo from SIM.

Given the information you have provided I could suggest the following:

Check your max232 schematics. The easiest case here is the you have somehow Rx/Tx connected, which would explain both - you seeing the echo and not communicating with SIM. To troubleshoot that - just connect your max232 to the computer with serial terminal program and on the output side of the converter connect Rx/Tx. You should see the echo. Then disconnect them - you should not see the echo.

General suggestion - this is not the exactly the right place for such discussions. That's more Question/Answer knowledgebase.

OpalApps
  • 149
  • 13