PDA

Click to See Complete Forum and Search --> : How do I know an AT Commands Executed


rplcmint
Nov 1st, 2001, 06:17 PM
Hello,

I'm having a problem issueing a simple AT command to a modem.

I'm using a MsComm control to open the modem port, so it will look like this:

With MsComm1
.portopen = true

.output "ATZ" 'Which should reset the modem quickly.

.portopen = false 'Drop the connection
end with

When I go check for the connection on Hyperlink..the modem did not receive my command.

Am I suppose to wait for an event to tell me that my command was successful? How do I do that.


I was also thinking that I am issueing the command wrong (probably should write it like this:)

MsComm1.output "ATZ" & vbCrLf


I need help cause this project is important.

I appreciate your input.

:D :rolleyes:

Hack
Nov 2nd, 2001, 11:27 AM
Check MSDN and see what you can find (http://msdn.microsoft.com/ )

rplcmint
Nov 2nd, 2001, 12:16 PM
I got it right....!!!!

I wrote:

.
.

MsComm1.Output = "ATZ" & vbCrLf 'Send a command to the port.

dim sTemp, b as string
sTemp = ""
Do until Instr(sTemp, "OK") > 0 or Instr(sTemp, "ERROR") > 0
b = MsComm1.Input
sTemp = sTemp & b 'Create a string to parse through.
Loop

.
.

The modem responds best when you pass the AT command along with a Carriage return line feed command.
Then you want to stay inside a loop while capturing the Input buffer and parsing through it for response..(I looked for an OK or ERROR. You can look for other responses). You can then write the rest of your code depending on the response (if error..do this, if Ok..do this, etc.)

This was a lot easier than I thought!

Thanks for the help.

Hack
Nov 2nd, 2001, 02:09 PM
Glad you got it worked out, and I'll file this away for future reference.

jax
Nov 5th, 2001, 01:55 AM
May i ask if a vb program can reset a modem when the modem is already being used by another program.

If not, is there a way to bypass it?