Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sending AT commands using QBASIC

Status
Not open for further replies.

teksys310

Technical User
Jul 6, 2004
4
0
0
GB
hey all,

Ive been trying to send some AT commands using qbasic but have had limited success. I downloaded a program from one of the forums thanks to "agual" and the terminal program there was great. HOWEVER :-(

I am sending this commmand,

ATE1N1X4&C0S8=2S9=5

The modem returns OK

I then send ATDT xxxxx-xxxxxx (uk)

The modem dials the number, this is where it gets tricky.

When i send the ATH command the modem disconnects but ALWAYS returns

NO CARRIER

But if it rings it should return RING, if its BUSY it should return BUSY but it does not. It always, always returns NO CARRIER!

Can someone please HELP !


 
ATH is hang up.
if you want it to complete the call don't use ath until
you are done.
 
When the other modem answers the calling modem should leave command mode. But as Buff1 notes, you are disconnecting before it has a chance to connect.
If this is hayes compatible you should be able to do a at$ for a command summary.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
BTW you can usually use (if i remember correctly) +++ to get back to the modem command mode
 
Thanks for your advice.

My ultimate goal is this.

To send an AT command using QB and then when the modem returns a result code i want to be able to capture the response within the program.

However it needs to be done quite quickly for example each call needs to return the correct result code within 5 seconds.

So when the call takes place if there is no answer the modem returns RING, or if its engaged it returns BUSY. But everytime the modem hangs up on its OWN or using ATH command i always receive the message NO CARRIER...
 
Have you looked at the X4 responses for your modem? The busy and ring responses may not be included in the command set.
Use a terminal emulator to connect the way you want QB to connect and see what the responses are.

Ed Fair
Give the wrong symptoms, get the wrong solutions.
 
Ok, Had a little frustrating play and looks like i can only get a NO ANSWER response if i use the @ i.e atdt123456@ but still not fully functional.

So my next question is... how can i capture response from a modem using QB, for example, I type AT, the repsonse is OK how do i get the "OK" in a variable for which i can use?
 
Try using a random or binary file for the com port.
then read/write to/from it.
 
Maybe this will help you. First I would like to say I'm learning as mess things up along the way hehe. Well the modem has lots of commands
ATS0=1 tells the modem to wait for a call connect after first ring
ATDT DIAL OUT
ATHT OR ATZ HANG UP
ETC
you can even set your modem up like a fraggin' caller id if you wanted to. Ok now about sending modem commands to the one machine to the other. First code then I'll explain. I need help so the net help me along the way and I got this code, but bugs where in it. In the end I got a full working chat program sending data to one box to the other.


OPEN "COM2:9600,N,8,1,RB2048,TB2048" FOR RANDOM AS #1
PRINT #1, "ATZ"
CLOSE

OPEN "COM1:9600,N,8,1,TB2048,RB2048" FOR RANDOM AS #1
PRINT #1, "ATDT4940716"

a$ = ""
DO
IF LOC(1) THEN a$ = a$ + INPUT$(1, 1)
LOOP UNTIL INSTR(a$, "CONNECT")
PRINT #1, a$

ok open the come etc
print #1, "MODEM COMMAND" tell to send a command to the modem
no that a$"" loop part waits till a connect is made and will
not go to the next line of code till it reads connect.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top