Board index » delphi » Sending Commands to a Modem

Sending Commands to a Modem

A couple of years ago,
I had written a program to send commands to a modem
{for dialing purposes}.
It worked fine then. {on a 486 in DOS}
Now, I'm on a Pentium with W'95.
When I try to run the program,
it crashes my DOS session with an error message of trying to execute an
illegal function.
Then, I can't get back to DOS.
I've narrowed it down to the WRITELN statement.
{$I-}
WriteLn (Comm_File, 'AT;');
{$I+}
Any suggestions??
 

Re:Sending Commands to a Modem


Quote
TOUCHSCREEN PROMOTIONS wrote in message ...
>A couple of years ago,
>I had written a program to send commands to a modem
>{for dialing purposes}.
>It worked fine then. {on a 486 in DOS}
>Now, I'm on a Pentium with W'95.
>When I try to run the program,
>it crashes my DOS session with an error message of trying to execute an
>illegal function.
>Then, I can't get back to DOS.
>I've narrowed it down to the WRITELN statement.
>{$I-}
>WriteLn (Comm_File, 'AT;');
>{$I+}
>Any suggestions??

Very good question!
Funny I too couldn't get my modem to work!
I don't know what method you used. But I sort off directly wriote to the
com-port!
Can you please tell us more about the difference between the computers!
maybe it's the modem! Windows sometimes block the stuff?

Re:Sending Commands to a Modem


Quote
NLHG wrote in message <81hdu7$fp...@ctb-nnrp1.saix.net>...

>TOUCHSCREEN PROMOTIONS wrote in message ...
>>A couple of years ago,
>>I had written a program to send commands to a modem
>>{for dialing purposes}.
>>It worked fine then. {on a 486 in DOS}
>>Now, I'm on a Pentium with W'95.
>>When I try to run the program,
>>it crashes my DOS session with an error message of trying to execute an
>>illegal function.
>>Then, I can't get back to DOS.
>>I've narrowed it down to the WRITELN statement.
>>{$I-}
>>WriteLn (Comm_File, 'AT;');
>>{$I+}
>>Any suggestions??

>Very good question!
>Funny I too couldn't get my modem to work!
>I don't know what method you used. But I sort off directly wriote to the
>com-port!
>Can you please tell us more about the difference between the computers!
>maybe it's the modem! Windows sometimes block the stuff?

I think it is windows!!!
I'll have to figure out some other way.
Here is the code that USED!!!! to work!

Program Test_Communications;

Uses
    CRT;

{***************************************************************************
*}

Function Check_Comm_Port (Comm_Port: Byte): Integer;

Const
     Comm_Delay = 250;

Var
   Comm: Text; Comm_Port_Str: String [1];

Begin
     Str (Comm_Port, Comm_Port_Str);
     Assign (Comm, 'COM' + Comm_Port_Str); Rewrite (Comm);
     {$I+} WriteLn (Comm, 'AT;'); {$I-}
     Delay (Comm_Delay);
     Check_Comm_Port := IOResult;
     Close (Comm)
End;

{***************************************************************************
*}

Begin
     ClrScr; Write ('The Modem on COM2 is ');
     If Check_Comm_Port (2) = 0 then Write ('ON!')
     Else Write ('OFF!'); ReadLn
End.

Re:Sending Commands to a Modem


Quote
> I think it is windows!!!
> I'll have to figure out some other way.
> Here is the code that USED!!!! to work!

><snip code>

You don't specify in the message: Did you upgrade modems when you upgraded
your computer? If you are now using a WinModem (many PCI modems are
WinModems) then Windows itself plays a key role in controlling the IO, and
getting it to work from either plain DOS or a DOS prompt is not a trivial
matter (I have never seen it accomplished). I suppose in theory if you knew
enough about the modem you could write your own DOS modem driver for it,
accessing the PCI bus yourself, but that would be *very* time consuming.
There's no real solution as far as I can see - get MS to support WinModems
through DOS prompts (I haven't tried it under Win2000, it's *possible* that
they have done that =) or acquire an old ISA modem from somewhere...

Lawrence Curwood,
Paradice Software,
Christchurch, New Zealand.

Re:Sending Commands to a Modem


Nope! Same {external USR} modem as before.
I'll probably have to do some port/uart stuff,
but that will have to wait until I have more time to devote to it.
Thanks to everyone anyways!!!

James

Quote
Lawrence wrote in message <81j37f$bnkg...@titan.xtra.co.nz>...
>> I think it is windows!!!
>> I'll have to figure out some other way.
>> Here is the code that USED!!!! to work!

>><snip code>

>You don't specify in the message: Did you upgrade modems when you upgraded
>your computer? If you are now using a WinModem (many PCI modems are
>WinModems) then Windows itself plays a key role in controlling the IO, and
>getting it to work from either plain DOS or a DOS prompt is not a trivial
>matter (I have never seen it accomplished). I suppose in theory if you knew
>enough about the modem you could write your own DOS modem driver for it,
>accessing the PCI bus yourself, but that would be *very* time consuming.
>There's no real solution as far as I can see - get MS to support WinModems
>through DOS prompts (I haven't tried it under Win2000, it's *possible* that
>they have done that =) or acquire an old ISA modem from somewhere...

>Lawrence Curwood,
>Paradice Software,
>Christchurch, New Zealand.

Other Threads