Modem Communication. 
Author Message
 Modem Communication.

When I use the code:

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

This should open the modem.... It doesn't even get passed opening
COM2... it just freezes and says "Unable to access Communications
Port"... I am POSITIVE my modem is on COM 2.... WIN 95, and TWO comm.
programs can back me up on it (Telix, and Procomm Plus) :)... So it's
not that... I've ran the program with no other windeows open (Win 95),
and also In just DOS mode.... It doesn't work! SAME ERROR MESSAGE! I
just got an E-MAIL saying that I shold be opening it FOR BINARY (instead
of RANDOM) and it should work.... Any ideas? I know my hardware, and the
port are just fine.  

        Also, How are COM3 & 4 accessed? SPECIFICALLY... Everyone alsways talks
about tricking the comp. my useing peek/poke or whatever, but how about
some HARD CODE? :)

thanks



Wed, 23 Jun 1999 03:00:00 GMT  
 Modem Communication.

Quote:

> When I use the code:

>         OPEN "COM2:9600,N,8,1" FOR RANDOM AS #1
>         PRINT #1, "ATZ"

> This should open the modem.... It doesn't even get passed opening
> COM2... it just freezes and says "Unable to access Communications
> Port"... I am POSITIVE my modem is on COM 2.... WIN 95, and TWO comm.
> programs can back me up on it (Telix, and Procomm Plus) :)... So it's
> not that... I've ran the program with no other windeows open (Win 95),
> and also In just DOS mode.... It doesn't work! SAME ERROR MESSAGE! I
> just got an E-MAIL saying that I shold be opening it FOR BINARY (instead
> of RANDOM) and it should work.... Any ideas? I know my hardware, and the
> port are just fine.

>         Also, How are COM3 & 4 accessed? SPECIFICALLY... Everyone alsways talks
> about tricking the comp. my useing peek/poke or whatever, but how about
> some HARD CODE? :)

Well you say you have a com2 but Basic doesn't think so for whatever
reason.
Let's try this, it'll address the com 3 & 4 thing as well.
How does Basic determine if a comport exists and if so what is the
hardware
port address for it?
Down in low memory in the BIOS data segment is where BIOS stores the
base
port address for up to 4 equipped com ports on bootup.

If you start Debug and type d40:0 at the prompt the first line of the
output will look something like this.

0040:0000  F8 03 F8 02 E8 03 E8 02-78 03 00 00 00 00 06 02  
........x....
           com1  com2  com3  com4
          (typical addresses , 00 00  =  not equipped)

When Basic opens a com port it looks at the above addresses to determine
the base port address for the com port so it can initialize the
hardware. If Basic
finds 00 00 for the port you are trying to open you will get the "Device
unavailable"
error. My guess is that Basic is finding 00 00 for your port 2 for
whatever reason.
How many comports do you have equipped?
Do the above addresses agree? (how many non 00 00 values?)
If so. What comport slots are they in?
I believe something there should shed some light on your problem.

As for the com3 & 4 part. It's as simple as swapping the base port
addresses
shown above. Say you wanted to open com3. All you need to do is swap the
F8 03
with the E8 03 then tell Basic to open com1.  When basic trys to open
com1 it actually
finds the base address for com3 and opens com3. It just thinks it's
com1.
(Just be sure to put the original values back when the program
terminates else it could
 create problems for other programs that access the comports.)

So it's just a DEF SEG = &h40 plus a couple of PEEKs and a couple of
POKEs.

There is one catch though.
You can only swap com3 with com1, and then only if com3 shares IRQ4 with
com1
You can only swap com4 with com2, and then only if com4 shares IRQ3 with
com2
This is due to the interrupt vector(s) that Basic hooks into to allow
the port(s)
to be interrupt driven.
The interrupt vectors are 0Bh and 0Ah  for IRQ3 & 4 respectively.
Whenever Basic opens com1 (could really be 3) it hooks into interrupt
vector 0Bh
so the IRQ line  used by that comport had better be connected to IRQ3 or
it's not gonna work.
Same deal for Vector 0Ah and IRQ4.

You can see from the above that you can never (in basic at least) use
com1 & 3
at the same time. Ditto for com2 & 4.
I said "never" but I do think is is possible with the right IRQ
configuration and
provided you know the configuration up front. I won't go into that now
though.

--


Bangor, Pa. USA



Sat, 26 Jun 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Modem to Modem Communications

2. Modem-Modem communication

3. Modem -Modem Communication

4. How to build modem communication program

5. voice - modem communication?

6. Modem Communications Tutorial

7. HELP - using Qbasic for modem communication.

8. Modem communications using QBasic?

9. Order Entry modem communications fix

10. HELP modem communication

11. Modem Communications

12. Modem Communication with Visual Basic

 

 
Powered by phpBB® Forum Software