This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Sending commands to GSM module

Hi, I use GSM Module(Wavecom 2686) to send SMS. Communication to the module is through the serial port (RXD,TXD).I tested the module by sending AT commands (as per the GSM Module Catalogue). Now I have to do the same using my uC(AT89S52). I tried to send the commands using printf function as given in the "Hello World" example. For this I initialised the controller for 9600 baud rate and other SFRs. Also included STDIO.H But it is not working and remains in the printf command without completing. What could be the reason? Pls note that I have very limited knowledge in programming.

Parents Reply Children
  • So take that as your starting point:

    Modify it to also receive characters;

    Verify that it can send to Hyperterminal (or whatever), and receive from Hyperterminal;

    Then modify it to send AT<CR> to the modem, and verify that you get the OK response...

  • I give below my program for sending a string through the serial port.During debugging it is working and giving the text in the serial window . But when I gave it through the RS232 interface IC (HIN 232) to the serial port of PC and tried to see the string with Hyperterminal, I am not getting the string displayed. Could it be any problem in my program? Any guidance will be highly appreciated

            #include <At89x52.h>
                    #include <stdio.h>
                    void init(void);
                    void main(void)
                     {
                     init();
    
    
                             while(1)
                               {
                                 printf("This is a trial message\n");
                               }
    
                            }
    
    
                    void init(void)
                      {
                            SCON  = 0x50;                   /* SCON: mode 1, 8-bit UART, enable rcvr      */
                        TMOD = 0x20;               /* TMOD: timer 1, mode 2, 8-bit reload        */
                        TH1   = 0xfd;
                            TL1 = 0xfd;               /* TH1:  reload value for 9600 baud @ 11.0592MHz   */
                        TR1   = 1;                  /* TR1:  timer 1 run                          */
                        TI    = 1;
                        TL0 = 0x00;
                            TH0 = 0x00;
    
                      }