This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Code for GSM Module (SIM 900) to sent an SMS using MSP-430

Other Parts Discussed in Thread: ENERGIA, MSP430G2553, MSP430G2533, MAX3232

Hi Guys, I'm new to msp430 board . I nedd to help check my program if i am wrong please correct me.

void setup(){
Serial.begin(9600);
}
void loop(){
if(condition){
sendsms();
}
}
void sendsms()
{
Serial.println("AT+CNMI=1,2,0,0");
Serial.println("AT+CMGS=\"0987654321\""); 
Serial.println("Just Kidding"); 
Serial.print(char(26));
delay(5000);
delay(5000);
}

  • you are using CCS? IAR? 

    Which one of the msp430? 

    you tested it?

     It is working as expected?

    What is the condition?

    What is supposed to do Serial()?

    You are the only person who wrote the program and knows what is supposed to do.

    Regards

  • Hi @Gaston_Melo_Arg,

    This is the modified code . I am using Energia. I am not using IAR/CCS

    #include<msp430.h>
    int flag=1;
    void setup()
    {
    Serial.begin(9600);
    }
    void loop(){
    if(flag)
    {
    flag=0;
    sendsms();
    }
    }
    void sendsms()
    {
    Serial.println("AT+CMGF=1\r\n");
    Serial.println("AT+CMGS=\"9738338403\"\r\n"); //Enter Mobile Number between double " " codes.
    Serial.println("Crack the COde testing\x1A"); //SMS to ur Mobile Number
    delay(5000);
    delay(5000);
    }

    I am using msp430g2553. Yes I have tested this code  . Yes it worked for two time after that it stopped working. You can refer to the above code for condition.  to serial have connected SIM-300 GSM module.  

  • How long is the delay time of Delay(5000)? 5000µs? 5000ms? 5000 MCLK cycles?

    You  print a lot to the serial. Each character takes 1ms to be sent. I don’t know whether the Serial object has a buffer for outgoing data. And how long the GSM takes to carry out the operation.
    You should synchronize your sending by the response of the GSM rather than just firing commands after a fixed delay.

  • Hi Jens-Michael Gross,

    Its 5000ms which equal to 5 secs .So as in the program I have used Delay(5000) twice. So it is a 10 sec time . As soon 10sec are over a sms is send . Thanks for your suggestions, But It's of no use for me right now . My program is working well and good for me. I am new to this msp-430 board an dI don't have much knowlegde in this feild about which your talking. If required in future i will  surely consider your suggestion.Hope, So I answered your question . If you want to decrease the delay you can.   

  • Is this code the working one? Or have you made modifications on it since the last time? Also can anyone verify this code for TELIT GL865?

  •    hello,

    you have right you code will be working,
    but if you want make more universal code
    you should use commands like below
    it is  minimium amount of commands
    believe me ( I have 8 years experience with gsm/gprs )


    ATE0 AT+CPIN? AT+CMGF=1 AT+CREG=1 AT+CREG? AT+CPMS? AT+CMGR=x AT+CMGD=x AT+CMGS

  • hello,
    I am using msp430g2533 board with gsm sim 900 to send sms. I have tried various code including this one too.

    #include<msp430.h>
    int flag=1;
    void setup()
    {
    Serial.begin(9600);
    }
    void loop(){
    if(flag)
    {
    flag=0;
    sendsms();
    }
    }
    void sendsms()
    {
    Serial.println("AT+CMGF=1\r\n");
    Serial.println("AT+CMGS=\"9738338403\"\r\n"); //Enter Mobile Number between double " " codes.
    Serial.println("Crack the COde testing\x1A"); //SMS to ur Mobile Number
    delay(5000);
    delay(5000);
    }


    every time it works only on serial monitor but sms is not sent to the mobile phone, I dont know if something is wrong with the software or hardware.
    I am using energia17.
    p1.1 of board is attached to txd of gsm
    p1.2 of board is attached to rxd of gsm
    please reply ASAP.

    Regards,
    Ikram Farooqui.
  • How do you connect the MSP to the serial monitor and how to the GSM modem? I mean the physical signals.
    Usually, modems require a V.24 signal level while the MSP uses TTL levels. You'll need a level converter like the MAX3232.
    Also, some modems require the DTR signal asserted or they will ignore any input.
    Also, the _usual_ nomenclature for Tx and RX is from the view of the DTE (data terminal equipment). So modem RX means the line on which the PC/MSP is listening, not the line the modem is listening on. And modem TX is the line on which it is listening to the PC/MSP. So you likely have to connect RX with RX and TX with TX. The connection you mentioned is the opposite.
    (note that serial monitor and MSP are both DTE, so RX means for both the signal _they_ are listening on themselves and you have to connect RX with TX).
    Yes, nomenclature may be confusing.

    "please reply ASAP."
    You'll get a reply when you get a reply. This is no paid 24h support line but a user forum. And most people here are just volunteering in our spare time.

**Attention** This is a public forum