Outline ·
[ Standard ] ·
Linear+
Communicate GSM Modem with VB6, stuck to enter AT command
|
TSmszazu
|
Jan 7 2009, 11:53 AM, updated 17y ago
|
New Member
|
Hye.. I am developing serial communication for siemens gsm modem. i'm stuck on how to insert at command into vb. I try using hyperterminal, and i found the command to send an sms to hp is as follows:
at+cmgf=1 OK at+cmgs=0191234567,145 > testing...sending sms to user's hp -> +CMGS: 62
OK at OK
after at+cmgs=0191234567,145, i need to presskey ENTER and after > testing...sending sms to user's hp, i need to press CTRL+Z ... this sign "->" is actually ctrl+z...i also don't know in vb, what code represent ctrl+z and ENTER>
Below is my VB source code. I think this at command need to be place at the part that i already bold. any idea guys? Tq! Option Explicit Private Sub Form_Load()
MSComm1.Settings = "9600,N,8,1"
MSComm1.DTREnable = False
MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub
Private Sub cmdExit_Click()
MSComm1.PortOpen = False End
End Sub
Private Sub cmdSend_Click()
MSComm1.Output =
End Sub
|
|
|
|
|
|
geekster129
|
Jan 7 2009, 05:49 PM
|
|
CTRL-Z = ASCII Code 26
|
|
|
|
|
|
xaragorn
|
Jan 7 2009, 06:43 PM
|
New Member
|
..
This post has been edited by xaragorn: Jan 7 2009, 06:49 PM
|
|
|
|
|
|
TSmszazu
|
Jan 7 2009, 11:09 PM
|
New Member
|
QUOTE(geekster129 @ Jan 7 2009, 05:49 PM) thx! it works.. // MSComm1.Output = "at+cmgf=1" + Chr$(13) MSComm1.Output = "at+cmgs=0191234567,145" + Chr$(13)// For this part, I actually wants to write like a normal equation. How do I write it without using MsComm1.Output? Rite now, when I send Sms, only half of the message received. I'm not sure why. Could be because of this part? Option Explicit Private Sub Form_Load()
MSComm1.Settings = "9600,N,8,1"
MSComm1.DTREnable = False MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub
Private Sub cmdExit_Click()
MSComm1.PortOpen = False End
End Sub
Private Sub cmdSend_Click() MSComm1.Output = "at+cmgf=1" + Chr$(13) MSComm1.Output = "at+cmgs=0191234567,145" + Chr$(13) MSComm1.Output = "ABC DEF GHI KLM NOP" + Chr$(26)
End SubThis post has been edited by mszazu: Jan 7 2009, 11:09 PM
|
|
|
|
|
|
geekster129
|
Jan 8 2009, 09:29 AM
|
|
QUOTE(mszazu @ Jan 7 2009, 11:09 PM) thx! it works.. // MSComm1.Output = "at+cmgf=1" + Chr$(13) MSComm1.Output = "at+cmgs=0191234567,145" + Chr$(13)// For this part, I actually wants to write like a normal equation. How do I write it without using MsComm1.Output? Rite now, when I send Sms, only half of the message received. I'm not sure why. Could be because of this part? Option Explicit Private Sub Form_Load() MSComm1.Settings = "9600,N,8,1"
MSComm1.DTREnable = False MSComm1.CommPort = 1
MSComm1.PortOpen = True End Sub
Private Sub cmdExit_Click()
MSComm1.PortOpen = False End
End Sub Private Sub cmdSend_Click() MSComm1.Output = "at+cmgf=1" + Chr$(13) MSComm1.Output = "at+cmgs=0191234567,145" + Chr$(13) MSComm1.Output = "ABC DEF GHI KLM NOP" + Chr$(26) End SubHi, For your information, for the best compatibility, you would need to include the init string (it's an AT command), and it is different for each model of the GSM modem, so you will need to search in Google or from your modem vendor. Besides that, try to experiment with the hardware settings, particularly the Baud Rate. This might also be a reason why you only receive half of the message. Is the message appeared half way in your phone? Thanks
|
|
|
|
|
|
TSmszazu
|
Jan 12 2009, 07:47 AM
|
New Member
|
I try it again, but this time, my hp received full message..thanks for ur help!
|
|
|
|
|
|
effectz
|
May 21 2009, 11:40 PM
|
|
|
|
|
|
|