delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/07/31/10:46:28

Message-ID: <35C1D850.BC0ED078@post.comstar.ru>
Date: Fri, 31 Jul 1998 18:44:33 +0400
From: Dim Zegebart <zager AT post DOT comstar DOT ru>
Reply-To: zager AT post DOT comstar DOT ru
Organization: Comstar Ltd.
MIME-Version: 1.0
To: Khoi N <newcool AT hotmail DOT com>, "djgpp AT delorie DOT com" <djgpp AT delorie DOT com>
Subject: Re: Hey Dim!!!
References: <19980712095140 DOT 17102 DOT qmail AT hotmail DOT com>


Khoi N wrote:

> Hey Dim,
>
>    Maybe ya didn't get my last email, or maybe your just really busy,

> but here I am again.  Well I didn't get a reply on the last email, and I

> just wanted to give it another try.

Oops, I have replayed your post and just forward that msg to you again.Sorry
for delay with this msg, I was in month's holiday and recently come back.

> Well what I asked before was: is it
> possible for two computers to connect using the modem,  with no active
> phone line ( no dialtone,  NULL i guess you can call it that )? That is,
> can you connect the computers using a direct phone line to each of them?
> My friend and I live kind of far from each other,  and testing the modem
> is a real hassle.  And most of the time my friend is busy and is unable
> to help me in my quest to achieve modem-programing victory.  If you can
> answer this question for me,  I would greatly appreciate it.  And if
> such a thing is possible, how do you do it?  I am no modem expert
> what-so-ever, and I must seem like a little programmer compared to such
> an experienced programer as you!

Thank you for many good words I just a man as you :)Only few models of modem
allows you connect directly without number dialing.
It connects via so called privet circuit. This privet circuit should be
provided by your
local phone operator for additional fee. This is exactly I connect my PC at
work
(I'm working at telephone company, so privet circuit is not a problem)
But I suppose what you are interesting in connecting two modems on your
table
just via two wires, unfortunately, only few from few modems capable to do it
and it
costs much money. Actually, I know only one such modem it's old UK made
device
with highest baud rate 1200.

> Sorry to bother you again,  but I got
> another question that I'd like to ask.  I have used the library to
> program the modem,  and I can't seem to find a way to detect rings when
> my friend calls.  Instead I have to enter ATA manually.  Is there a way
> to detect rings and connect modems automatically?  Please answer this
> question,  I'm dying to know the answer.  A problem I've experienced
> with the library was using the comm_port_command _send() function.  When
> I call it, using one of the AT commands, it works fine.  But the problem
> is when I send two or more commands after it in a sequense, the commands
> don't make it through.  For example:
>
>

From dzcomm.txt

int (*msr_handler)() - you may provide handler for
  'modem status register change' interrupt. Declare this handler as :
  int my_msr_handler(int c). This handler will be called by a system
  with c=inportb(port->MSR).
  Note : since this handler called inside interrupt handler keep it
  fast and small as possible. Take care about stuff you do inside, and
  don't forget to lock this code in memory.
  See also : comm_port_init.

int RingStatus;

int my_msr_handler(int msr_value)
{
   if (msr_value&0x08) RingStatus=1;
  return(0);
}ring()
{
  ....
  RingStatus=0;
}

int main(int argc,char argv[])
{ comm_port *myport;
  char c;
...
  myport->msr_handler=my_msr_handler;
 ...
 while(1)
  { ...
    if (RingStatus==1) ring();
    ...
  }

 return(0);
}

> comm_port *myport;
> char c;
> ...
> ...
> comm_port_command_send(myport,"ATZ\r");  //Inits modem
> comm_port_command_send(myport,"ATH\r");  // Hangs up modem
> comm_port_command_send(myport,"ATE1\r"); // Turns on echoing, sends
> //  commands back to buffer
> while(c=comm_port_test(myport)) {
> putc(c);
> }
>
>

comm_port_command_send() sends '\r' for you, so just send AT command with
out '\r' at the end

> This gives and output of:
>
> ATZ
> OK
>
> That's it!  This must be a delay problem of some sort.  Is there a way
> to delay execution until each command has been succesfully sent?  If
> there is a way,  just tell me what to do and I'll try to pitch in and
> write the code to put in that delay.
>

Search Allegro' doc for timer section ( I can't remember the exact delay
function name)

> Thanks so much for listening to me again Dim.  Please answer my
> questions,  I'm just so anxious for answers.  You've been a great
> listener,  and I just appreciate all the work and help that you've
> given.  Please write back!

You are welcome.

PS. I double this msg in djgpp mail list.

--
____ ____
|   \   /   Dim Zegebart
____/____

Moscow Russia
WWW - http://www.geocities.com/siliconvalley/pines/7817
DZcomm - comm library for Allegro
Palantir - multitasking kernel for Allegro (based on PDMLWP)


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019