serial-portgsmuartmicrochipsim900

seial communication between GSM and PIC16F877A


Please help I'm trying to prepare a project that need serial communication between PIC16F877A and a GSM sim900 so that I can send and receive sms from a remoteness here is the peace of code to send sms writen in MPLAB XC8 `

           UART_Write_Text("AT+CMGF=1");
         __delay_ms(500);
          UART_Write_Text("AT+CMGS=\"+25XXXXXXXXX\"\n\r");
          __delay_ms(500);
          UART_Write_Text("Fuse number 1 had blown up");
          __delay_ms(500);
          UART_Write(26);
        __delay_ms(6000);
         UART_Write_Text("AT+CMGF=1");
         __delay_ms(500);
          UART_Write_Text("AT+CMGS=\"+255XXXXXXX\"\n\r");
          __delay_ms(500);
          UART_Write_Text("Fuse number 2 had blown up");
          __delay_ms(600);
          UART_Write(0x1A);
        __delay_ms(6000);
         UART_Write_Text("ATD+25XXXXXXX;");
         __delay_ms(6000);`

you can see I was trying to check if the problem was the ASCII character 26,which is used to terminate the sms,but the problem is that PIC chip fail to communicate with GSM, due to different voltage levels I tried to use MAX232,I initial made the interface through MAX232 as shown below,GSM interface with PIC16F877A through MAX232 but nothing sent, I tried to swap the serial pins without max232 still nothing sent. then I tried to change GSM SIM900 with GSM SIM900A min, which has three options of ports, RS232, 3V Tx and Rx, 5V Tx and Rx, since PIC16F877a it's logical voltage is 5v so I used 5V port but still nothing sent. but both GSMs and PIC communicate fine with hyperterminal of the laptop through 5v FTDI breakout port.


Solution

  • I'm afraid your must limit your problem first: hardware or software. Do you have a schema of your connections?

    By the other hand, In your code you use this function:

    UART_Write_Text("AT+CMGF=1");
    

    Should not you to finish that line with a \r\n or \n\r, or UART_Write_Text does it for you?