I have a GSM modem, Wavecom.
When I connect to it using HyperTerminal, i can send SMS with the standard AT comands, like this:
AT+CMGS="+351nn nnnnnnn" <CR>
> text to send in the message <Control-Z>
and the SMS goes on.
Note: <CR> means ENTER
Note: <CR> is ASCII 13, and Control-Z is ASCII 26.
When I use VisualBasic, the SAME AT sequence does not work.
And I get an ERROR (twice).
The manual says to do the following:
MSComm.Output = "AT+CMGS=" & chr(34) & "+ "+351nnnnnn nnn" & chr(34) & chr(13)
MsComm.Output = "text to send in the message" & chr(26).
Note: chr(34) is the character for the commas(").
What is wrong?
Many thanks for any help.
17 12492
Hi. You could try this - Const quote As String = """"
-
MsComm.Output = "AT+CMGS=" & quote & "+351nnnnnnnnn" & quote & vbCr
I have a GSM modem, Wavecom.
When I connect to it using HyperTerminal, i can send SMS with the standard AT comands, like this:
AT+CMGS="+351nn nnnnnnn" <CR> > text to send in the message <Control-Z>
and the SMS goes on.
When I use VisualBasic, the SAME AT sequence does not work.
And I get an ERROR (twice).
The manual says to do the following:
MSComm.Output = "AT+CMGS=" & chr(34) & "+ "+351nnnnnn nnn" & chr(34) & chr(13)
MsComm.Output = "text to send in the message" & chr(26).
A couple of questions... - Are you certain that it's only a CR which is sent after the AT command?
- What error are you getting?
- What does the ">" represent on the second line? (I ask mainly because it is not present in the VB version.)
- Are you sure you're in command mode? I seem to recall (from more than 10 years ago, I think) that you have to pause for at least a second, then send "+++" then another pause, to go into command mode. But this probably only applies if you are online at the time, right?
- Is this code copied/pasted, or typed in here? Because
MSComm.Output = "AT+CMGS=" & chr(34) & "+ "+351nnnnnn nnn" & chr(34) & chr(13)
seems to have quotes in the wrong places. It probably should have been MSComm.Output = "AT+CMGS=" & chr(34) & "+351nnnnnn nnn" & chr(34) & chr(13)
You can also make the code much more compact and readable by using CONST values as willakawill suggested. (Oops! Didn't realise you'd also fixed the mixed-up quotes, Will.)
Yeah. Get with it down there. You're supposed to be 13 hours ahead of me :)
iburyak 1,017
Recognized Expert Top Contributor
It looks like your error is here:
[PHP]"+ "+351nnnnnn nnn" [/PHP]
You have "+ twice.
iburyak 1,017
Recognized Expert Top Contributor
Try this:
MSComm.Output = "AT+CMGS=""+351 nnnnnnnnn""" & chr(13)
MsComm.Output = "text to send in the message" & chr(26).
Try this:
MSComm.Output = "AT+CMGS=""+351 nnnnnnnnn""" & chr(13)
MsComm.Output = "text to send in the message" & chr(26).
You are posting the same answer that has already been posted by 2 others
Yeah. Get with it down there. You're supposed to be 13 hours ahead of me :)
Yeah, well it's hard to forecast accurately what someone is going to say in 13 hours. ;)
I have a GSM modem, Wavecom.
When I connect to it using HyperTerminal, i can send SMS with the standard AT comands, like this:
AT+CMGS="+351nn nnnnnnn" <CR>
> text to send in the message <Control-Z>
and the SMS goes on.
Note: <CR> means ENTER
Note: <CR> is ASCII 13, and Control-Z is ASCII 26.
When I use VisualBasic, the SAME AT sequence does not work.
And I get an ERROR (twice).
The manual says to do the following:
MSComm.Output = "AT+CMGS=" & chr(34) & "+ "+351nnnnnn nnn" & chr(34) & chr(13)
MsComm.Output = "text to send in the message" & chr(26).
Note: chr(34) is the character for the commas(").
What is wrong?
Many thanks for any help.
Hi friend,
I've been in that kind of situation before and I used VB6 too, I developed a computer program that will keep all the SMS to my database and reply back with some information.
Ok here is the answer, before i tried that using chr(13) because this is the equivalent for the new line but unfortunately i dont know why this chr(13) is not working in MSCOM, but the only thing left is the constant value of VBCRLF you can use this as a substitute in chr(13)
Inshort
chr(13) = VBCRLF
and dont forget to send +++ it means that you will set the GSM in Command mode. Some1 already post this one, you better be careful in sending AT Command always keep in mind that before sending another batch of command you need to wait just for a second or 2, just use Sleep function in VB6.
Actually, after I solved that problem reagrading GSM and MSCOMM I realized that ANSI C is the much better language to use beacuse it is very easy to communicate with Devices like GSM. I am just telling you this because I experienced that before, but it will work fine in VB6 with MSCOMM
Norman
Hi friend,
I've been in that kind of situation before and I used VB6 too, I developed a computer program that will keep all the SMS to my database and reply back with some information.
Ok here is the answer, before i tried that using chr(13) because this is the equivalent for the new line but unfortunately i dont know why this chr(13) is not working in MSCOM, but the only thing left is the constant value of VBCRLF you can use this as a substitute in chr(13)
Inshort
chr(13) = VBCRLF
and dont forget to send +++ it means that you will set the GSM in Command mode. Some1 already post this one, you better be careful in sending AT Command always keep in mind that before sending another batch of command you need to wait just for a second or 2, just use Sleep function in VB6.
Actually, after I solved that problem reagrading GSM and MSCOMM I realized that ANSI C is the much better language to use beacuse it is very easy to communicate with Devices like GSM. I am just telling you this because I experienced that before, but it will work fine in VB6 with MSCOMM
Norman
EXAMPLE: - Option Explicit
-
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
-
-
-
Private Sub Command1_Click()
-
Dim strSMS As String
-
'set contact number
-
'buffer you message here
-
strSMS = "Hello World!"
-
'Before sending command
-
MSComm1.Output = "+++" & vbCrLf
-
'wait a second
-
Sleep 1
-
'send at commands
-
MSComm1.Output = "AT+CMGS=" & Chr(34) & "+351nnnnnnnnn" & Chr(34) & vbCrLf
-
-
'There are some GSM modems that after sending "AT+CMGS"
-
'it will response before buffering the message
-
-
'Ex.
-
' step 1: MSComm1.Output = "AT+CMGS=" & Chr(34) & "+351nnnnnnnnn" & Chr(34) & vbCrLf
-
' step 2: MSComm1.Input is equal to OK/ERROR
-
' step 3: then > insert your message
-
-
'In this case the GSM is allowing you to check first if the AT command is valid or not
-
'before buffering the message to GSM
-
-
'I dont know if this is your case but you can check.
-
-
While 1
-
'wait for 1 second or 2
-
-
Sleep 1 'this is depend on how fast your GSM communicate with MSCOMM
-
-
'Always wait this > sign to come out, because this the signal that the GSM is ready
-
'to get the Message
-
-
'if MSComm1.Input = ">" send your Message to GSM
-
-
'note: make it sure that no other chr(s) in MSComm1.Input except ">"
-
'The last thing to remember is do not ever try to use the DOEVENTS
-
-
If StrComp(Left(MSComm1.Input, 1), ">", vbBinaryCompare) = 0 Then
-
MSComm1.Output = strSMS & Chr(26)
-
Sleep 2
-
'Before you do this pls remove the chr(26)
-
If StrComp(Replace(MSComm1.Input, Chr(26), ""), "OK", vbBinaryCompare) = 0 Then
-
'place your flag
-
GoTo ExitWhile
-
ElseIf StrComp(Replace(MSComm1.Input, Chr(26), ""), "ERROR", vbBinaryCompare) = 0 Then
-
'place your flag
-
GoTo ExitWhile
-
Else
-
End If
-
Wend
-
-
ExitWhile:
-
'do your valdations here etc
-
'Check your falg here if error is true or false
-
Sleep 2
-
-
-
End Sub
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Kees Bakelaar |
last post by:
Hi all,
This is not really a VB question, however, i am stuck a modem problem
The modem is connected to a cristie teleport with a speed of 9600 bps.
How can i set the modems DTE speed at fixed to 9600 bps ?
sometimes, the modem has a different DTE speed, i have to disconnect the
|
by: Anne |
last post by:
Hi NG
I got a problem. I use the following code to print out reports imidiately:
Docmd.openReport "RptCase", acviewNormal
This works fine at the office and at home, but at a customer it don't work -
anyone knows what the problem is, at what to do about it?
Thx in advance
|
by: Filips Benoit |
last post by:
New attempt: previous discussion 18/09/2004 stopt !
W2000
office2000
Added ref to 'Microsoft CDO for NTS 1.2 Library'
No code error
BUT NO emails send
What's missing?
Please help!
|
by: Cc |
last post by:
hi,
I making a program to control modem , I had follow example from MS website
on how to access serial port but still don't know how to make modem dial .
Is there any example on how I could make modem dial?
|
by: tnhoe |
last post by:
Hi,
I am looking for above. Any recommendation ?
The GSM modem is a data card with phone chip in notebook which can send sms directly without going through other sms gateway URL.
I only need to programming api/lib to send sms.
Regards
Hoe
| |
by: Franc Zabkar |
last post by:
My D-Link DSL-302G modem/router has a real-time clock whose settings
are volatile. To avoid hand keying the date/time via the modem's JS
interface, I wonder if there is a way to copy the JS code to the hard
drive and modify it to automatically retrieve the PC's date/time. I
could then add the hacked JS page to my browser's bookmarks. I've
already successfully modified and adapted other modem menus, but I
don't know how to go about this...
|
by: vgonepudi |
last post by:
Hi,
Requirement: I want to send numeric message to pager.
For that I have developed an application in VC++. My application takes
pager number as input and dials that number through my local modem.
After establishing the connection I am getting a message like "Enter
numeric message after beep".
1) How can I find whether connection is established or not?
|
by: Tym |
last post by:
Not sure this is the right group - but here goes.
I kinda expect Dick Grier to jump in on this one ;-)
I've got a windows app in VB.Net 2005 which sends and receives text messages
via a USM GSM modem. THe app cycles to poll the modem for incoming SMS as
well as pausing this cycle to send...
Working absolutely fine... except....
|
by: Tym |
last post by:
Not sure this is the right group - but here goes.
I kinda expect Dick Grier to jump in on this one ;-)
I've got a windows app in VB.Net 2005 which sends and receives text messages
via a USM GSM modem. THe app cycles to poll the modem for incoming SMS as
well as pausing this cycle to send...
Working absolutely fine... except....
|
by: muruganyuva |
last post by:
hi,
in my project i'm sending the data from source to destination with the help of modem.
one modem at the source and other at the destination.
at first i'm initializing the source modem.
"AT E0 V1 X4 N1 &D0 &K0 S0=2"
Then i connects the modem and transfer the data.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |