13 Replies - 2006 Views - Last Post: 17 February 2013 - 03:25 AM Rate Topic: -----

#1 newaudrey  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 162
  • Joined: 08-July 10

how to know if AT command executed properly in vb.net

Posted 13 February 2013 - 09:55 PM

this is my codes to send message

                With Port

                    .Write("AT" & vbCrLf)
                    .Write("AT+CMGF=1" & vbCrLf) 'Instruct the GSM / GPRS modem to operate in SMS text mode
                    .Write("AT+CMGS=" & Chr(34) & txtnumber.Text & Chr(34) & vbCrLf)
                    .Write(txtmessage.Text & Chr(26))
                End With



i can receive the message but how to know if the at command is successfully executed.

the output of the command AT is "ok" and at+cmgs is ">"

does the ">" simply mean that it executed properly the at+cmgs command?

Is This A Good Question/Topic? 0
  • +

Replies To: how to know if AT command executed properly in vb.net

#2 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5512
  • View blog
  • Posts: 11,818
  • Joined: 02-June 10

Re: how to know if AT command executed properly in vb.net

Posted 14 February 2013 - 06:05 AM

Here's a way to do your own testing...
Send a completely bad command on purpose.
Send the command "Ghostbuster" to the modem. What response do you get?
Was This Post Helpful? 0
  • +
  • -

#3 newaudrey  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 162
  • Joined: 08-July 10

Re: how to know if AT command executed properly in vb.net

Posted 14 February 2013 - 06:41 AM

tnx for the reply sir


with this code

Write("AT" & vbCrLf)


i received "ok"

with this code
Write("Ghostbuster" & vbCrLf)

no output
Was This Post Helpful? 0
  • +
  • -

#4 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5512
  • View blog
  • Posts: 11,818
  • Joined: 02-June 10

Re: how to know if AT command executed properly in vb.net

Posted 14 February 2013 - 06:46 AM

Great so you have your answer. If you don't get an affirmative response of "ok" then it failed.
Was This Post Helpful? 1
  • +
  • -

#5 newaudrey  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 162
  • Joined: 08-July 10

Re: how to know if AT command executed properly in vb.net

Posted 14 February 2013 - 07:05 AM

tnx sir. can u give me a link how to read message on my sim

i have this command but give me error

Write("AT+CMGL=\"ALL\"" & vbCrLf)
 

Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5512
  • View blog
  • Posts: 11,818
  • Joined: 02-June 10

Re: how to know if AT command executed properly in vb.net

Posted 14 February 2013 - 07:22 AM

Sorry. I have no experience with that sort of thing. You're going to have to keep Google-ing for examples and tutorials. You might check with the maker of the modem as they probably have an API for developers.
Was This Post Helpful? 0
  • +
  • -

#7 newaudrey  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 162
  • Joined: 08-July 10

Re: how to know if AT command executed properly in vb.net

Posted 14 February 2013 - 07:38 PM

ok thank you sir ill wait if someone knows how to solve my problem. i cant find a solution. im google-ing it for almost 3 days
Was This Post Helpful? 0
  • +
  • -

#8 newaudrey  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 162
  • Joined: 08-July 10

Re: how to know if AT command executed properly in vb.net

Posted 15 February 2013 - 06:32 AM

this is my code

when i set to pdu
.Write("AT+CMGF=0" & vbCrLf)


i can receive message by this code
but the output are numbers
.Write("AT+CMGL=4" & vbCrLf)





so i want to set in text mode
.Write("AT+CMGF=1" & vbCrLf)


but the output are ERROR using this code
.Write("AT+CMGL=all" & vbCrLf)





the at command for read sms are at+cmgl="all"
so i wrote this code
.Write("AT+CMGF="all"" & vbCrLf)


but vb.net says

Comma, ')', or a valid expression continuation expected

so please how to solve this

This post has been edited by newaudrey: 15 February 2013 - 06:34 AM

Was This Post Helpful? 0
  • +
  • -

#9 tlhIn`toq  Icon User is online

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5512
  • View blog
  • Posts: 11,818
  • Joined: 02-June 10

Re: how to know if AT command executed properly in vb.net

Posted 15 February 2013 - 07:19 AM

Should be merged with
http://www.dreaminco...1&#entry1802498

[quote]1 .Write("AT+CMGF="all"" & vbCrLf)
[/quote]


You can't put quotes inside of quotes.
The first quote before AT would be the open quote
The second quote before all would be the close quote
that means all is not inside quotes at all.

If you have no clue about the language you are coding in you should stop trying to design a program in it and just study a couple "Learn VB.NET in 30 days" type books. You can't just make up syntax as you go along and expect the compiler to know what you want. You have to take the time to learn before you can build.
Was This Post Helpful? 0
  • +
  • -

#10 newaudrey  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 162
  • Joined: 08-July 10

Re: how to know if AT command executed properly in vb.net

Posted 16 February 2013 - 05:26 AM

i forgot the qoutes
i solved the receiving of sms by this code. but i cant read the message its all number

i even set GPRS modem to operate in SMS text mode

please help me.


.Write("AT+CMGF="all"" & vbCrLf)

This post has been edited by newaudrey: 16 February 2013 - 07:04 AM

Was This Post Helpful? 0
  • +
  • -

#11 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: how to know if AT command executed properly in vb.net

Posted 16 February 2013 - 05:22 PM

The AT+CMGF= command takes a 0 or a 1.

As well, as has been pointed out to you, you cannot use quotes inside quotes.

Have a look at the GSM AT Command Set to see what you can use to control your modem.

As for your AT+CGML command, you need to send AT+CGMK="ALL", but you can't send it as you did. Use:

.Write("AT+CGML=""ALL""" & vbCrLf)


Whenever you need to put a quotation mark inside a String, use two quotaion marks. In the example above, ""ALL"" gives you "ALL" in the string. So the output from the Write is AT+CGML="ALL"

Here's another link for you. it's a GSM tutorial.
Was This Post Helpful? 0
  • +
  • -

#12 newaudrey  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 162
  • Joined: 08-July 10

Re: how to know if AT command executed properly in vb.net

Posted 16 February 2013 - 10:40 PM

ive got it working using this codes.

'Instruct the GSM / GPRS modem to operate in SMS text mode
.write ("AT+CMGF=1" & vbcrlf)


'read SMS text messages from SIM
.write ("AT+CPMS=""SM""" & vbcrlf)

'read all message
qw = AT(Port, "AT+CMGL=""all""" & vbCrLf) 'read
TextBox1.Text = qw




but how to list all the message in the listbox or listview. it shows all the message in my listview by just one line

i want every message to go to the next line. how to do it?

This post has been edited by newaudrey: 17 February 2013 - 03:25 AM

Was This Post Helpful? 0
  • +
  • -

#13 lar3ry  Icon User is offline

  • Coding Geezer
  • member icon

Reputation: 310
  • View blog
  • Posts: 1,290
  • Joined: 12-September 12

Re: how to know if AT command executed properly in vb.net

Posted 16 February 2013 - 10:56 PM

View Postnewaudrey, on 16 February 2013 - 11:40 PM, said:

i want every message to go to the next line. how to do it?

That depends on how you are storing your messages, how they are delimited, and so on. Without seeing your code that gets the messages, it's hard to figure out what you should do.

Basically, split the messages into individual messages, then add them one at a time to the ListBox or ListView.
Was This Post Helpful? 0
  • +
  • -

#14 newaudrey  Icon User is offline

  • D.I.C Head

Reputation: -3
  • View blog
  • Posts: 162
  • Joined: 08-July 10

Re: how to know if AT command executed properly in vb.net

Posted 17 February 2013 - 03:25 AM



This post has been edited by newaudrey: 17 February 2013 - 03:27 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1