Solved

code for sms using GSM MODEM

Posted on 2004-04-30
6
2,056 Views
Last Modified: 2013-12-09
can u provide me the code for sending sms from pc to mobile using GSM modem?
0
Comment
Question by:pritibang
  • 3
6 Comments
 
LVL 2

Accepted Solution

by:
anupvijay earned 63 total points
ID: 10957010
pritibang,
Which programming language are you using ?

Assuming that it is VB here is link from a mailing list that might help you.

http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=39c0b8fd%240%242390%40reader5&rnum=2&prev=/groups%3Fhl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26q%3DSend%2BSMS%2Bcode

Cheers.
0
 
LVL 5

Expert Comment

by:amit1978
ID: 10985272
Hi,

What technology (Vb,C....)u r using to send and receive message and type of GSM (Nokia, Sime...)

Amit
0
 
LVL 5

Assisted Solution

by:amit1978
amit1978 earned 62 total points
ID: 10985282
Assumin ur using VB and MSComm control for send and receive SMS.

Thru this code u can send the SMS thru GSM modem. here i am posting the code check this out:

Code to send SMS:
~~~~~~~~~~~~~~

Private Sub SendMsg(strMsg As String, Number$)
    Dim DialString$, FromModem$, dummy

    ' AT is the Hayes compatible ATTENTION command and is required to send commands to the modem.
    ' DT means "Dial Tone." The Dial command uses touch tones, as opposed to pulse (DP = Dial Pulse).
    ' Numbers$ is the phone number being dialed.
    ' A semicolon tells the modem to return to command mode after dialing (important).
    ' A carriage return, vbCr, is required when sending commands to the modem.
    ' box is ctrl+z command

    DialString$ = "AT+CMGS=" & Chr(34) & Number$ & Chr(34) & ",145" & vbCr & strMsg & "" & Chr(27)
   
  'explain later
    Call fnOpenPort
   
   
    ' Flush the input buffer.
    MSComm1.InBufferCount = 0
    Command3.Enabled = False
    Command4.Enabled = True
   
   
    MSComm1.Output = "AT+CMGF=1" & Chr$(13) & Chr(10) 'ok meaage is returened
   
    WaitMs 15000
   
    ' Dial the number.
    MSComm1.Output = DialString$
   
    WaitMs 15000
   
    MSComm1.PortOpen = False
   
    ' Disconnect the modem.
    'MSComm1.Output = "ATH" + vbCr
   
    ' Close the port.
    'MSComm1.PortOpen = False
End Sub

Private Function fnOpenPort()
  MSComm1.CommPort = 2
  MSComm1.Settings = "9600,N,8,1"
  MSComm1.Handshaking = 2
 
  On Error Resume Next
 
  ' Communications port settings.
  ' Assuming mouse is attached to COM1, GSM MODAM is set to 2
  ' Open the communications port.
 
  MSComm1.PortOpen = True
  If Err Then
     MsgBox "COM2: not available. Change the CommPort property to another port."
     Exit Function
  End If
 
End Function
0
 
LVL 5

Expert Comment

by:amit1978
ID: 10985287
this code will help u to send sms with the help of VB and MSComm control.

Amit
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Coaxial cable bending There are several factors that govern the selection of coaxial cable for your Machine to Machine (M2M) application: the location of cable runs, either indoor or outdoor, inside or outside an enclosure, maximum bending and the…
In this article we have discussed about the OS X EI Capitan and how to fix Wi-Fi issue in OS X El Capitan. We have explained how to delete system level preferences and create a new Wi-Fi location to resolve Wi-Fi issue.
This Micro Tutorial will show you how to maximize your wireless card to its maximum capability. This will be demonstrated using Intel(R) Centrino(R) Wireless-N 2230 wireless card on Windows 8 operating system.
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question