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

How to interface GSM module with 89s52

I am able to connect my sim900 gsm module with hyper terminal but I am not able to connect it with 89s52. Please help me to connect it.

Parents
  • I connect TX pin of gsm module with Rx pin of 89s52 and Rx pin of gsm with Tx pin of 89s52.
    I use this program,
    #include <REGX51.H>
    #include <AT89X51.H>
    unsigned char *command_AT = "AT\r";
    unsigned char *command_CMGF = "AT+CMGF=1\r";
    unsigned char *command_CMGS = "AT+CMGS=\"Mobile Number\"\r";
    unsigned char *message = "Message";
    unsigned char *CTRLZ = "\x1A";

    void puts(unsigned char* ptr);
    void putc(unsigned char chr);
    void sendsms(void);
    void initialize();

    main()
    { initialize();
    sendsms();
    while(1);
    }

    void initialize()
    { SCON = 0x50; /*SCON: mode 1, 8-bit UART, enable receive */
    TMOD |= 0x20; /*TMOD: timer 1, mode 2, 8-bit */
    TH1 = 0xFD; /*TH1: for 9600 baud */
    TR1 = 1; /*TR1: timer 1 run */
    }

    void sendsms()
    { puts(command_AT);
    puts(command_CMGF);
    puts(command_CMGS);
    puts(message);
    puts(CTRLZ);
    }

    void puts(char* p)
    { char *temp = p; /*temp pointer so that the actual pointer is not displaced */
    while(*temp != 0x00)
    { putc(*temp);
    temp++;
    } }

    void putc(unsigned char chr)
    { SBUF = chr;
    while(TI==0); /*Wait until the character is completely sent */
    TI=0; /*Reset the flag */
    }

    I want to send message by GSM module using 89s52.
    When i burn this program in micro controller. There is no result come.

Reply
  • I connect TX pin of gsm module with Rx pin of 89s52 and Rx pin of gsm with Tx pin of 89s52.
    I use this program,
    #include <REGX51.H>
    #include <AT89X51.H>
    unsigned char *command_AT = "AT\r";
    unsigned char *command_CMGF = "AT+CMGF=1\r";
    unsigned char *command_CMGS = "AT+CMGS=\"Mobile Number\"\r";
    unsigned char *message = "Message";
    unsigned char *CTRLZ = "\x1A";

    void puts(unsigned char* ptr);
    void putc(unsigned char chr);
    void sendsms(void);
    void initialize();

    main()
    { initialize();
    sendsms();
    while(1);
    }

    void initialize()
    { SCON = 0x50; /*SCON: mode 1, 8-bit UART, enable receive */
    TMOD |= 0x20; /*TMOD: timer 1, mode 2, 8-bit */
    TH1 = 0xFD; /*TH1: for 9600 baud */
    TR1 = 1; /*TR1: timer 1 run */
    }

    void sendsms()
    { puts(command_AT);
    puts(command_CMGF);
    puts(command_CMGS);
    puts(message);
    puts(CTRLZ);
    }

    void puts(char* p)
    { char *temp = p; /*temp pointer so that the actual pointer is not displaced */
    while(*temp != 0x00)
    { putc(*temp);
    temp++;
    } }

    void putc(unsigned char chr)
    { SBUF = chr;
    while(TI==0); /*Wait until the character is completely sent */
    TI=0; /*Reset the flag */
    }

    I want to send message by GSM module using 89s52.
    When i burn this program in micro controller. There is no result come.

Children