Com3 and Com4 from QuickBasic 4.5 
Author Message
 Com3 and Com4 from QuickBasic 4.5

I've been having a hell of a time trying to get QuickBasic to open com 3
and 4 for a comm program I'm writing.  Does anyone have any way that works
in Quick Basic, or have a library file that will do it.

                Thanx in advance.



Wed, 17 Feb 1999 03:00:00 GMT  
 Com3 and Com4 from QuickBasic 4.5

Quote:

>I've been having a hell of a time trying to get QuickBasic to open com 3
>and 4 for a comm program I'm writing.  Does anyone have any way that works
>in Quick Basic, or have a library file that will do it.

 OPEN "COM3" FOR ETC. AS #N


Thu, 18 Feb 1999 03:00:00 GMT  
 Com3 and Com4 from QuickBasic 4.5

Quote:

> I've been having a hell of a time trying to get QuickBasic to open com 3
> and 4 for a comm program I'm writing.  Does anyone have any way that works
> in Quick Basic, or have a library file that will do it.

>                 Thanx in advance.

Yep.  This QB code ought to do the trick.  It can swap Com1 with Com3, or
Com2 with Com4, thereby giving you control of Com3 and Com4.  Well,
that's a little confusing, but the code is actually very simple.  

There are only six lines of code, 3 for each COM port (two to swap the
ports, and 1 to reset the ports).  They are commented, so you should have
no trouble separating them.

'start of code

  'Swap COM1 & 3; now you can use COM3 as if it was COM1
  DEF SEG = 64
  POKE &H0, &HE8

  'Swap COM2 & 4; now you have use of COM4 as if it were COM2
  DEF SEG=64
  POKE &H2, &HE8

  'This line MUST be used to reset COM3 to COM1
  POKE &H0, &HF8

  'Use this line to reset COM4 to COM2
  POKE &H2, &HF8

'end of code

-Jesse

--
====================================
Very funny Scotty!
Now beam down my clothes!
====================================



Thu, 18 Feb 1999 03:00:00 GMT  
 Com3 and Com4 from QuickBasic 4.5

UR>I've been having a hell of a time trying to get QuickBasic to open com 3
UR>and 4 for a comm program I'm writing.  Does anyone have any way that works
UR>in Quick Basic, or have a library file that will do it.

The easiest (but not the safest.. still, safe enough in most cases)
method is to swap the base addresses around in the BIOS data space
before opening the com port. Note that you can swap the addresses, open
the port, and swap them back and it'll work fine. You don't need the
addresses to be swapped still for the com port input and output routines
to work. If you need an example on how to do this, you can email me, but
somebody will probably end up showing you how anyway.



Tue, 23 Feb 1999 03:00:00 GMT  
 Com3 and Com4 from QuickBasic 4.5

DA>>I've been having a hell of a time trying to get QuickBasic to open com 3
DA>>and 4 for a comm program I'm writing.  Does anyone have any way that works
DA>>in Quick Basic, or have a library file that will do it.
DA> OPEN "COM3" FOR ETC. AS #N

Using this method doesn't allow you to initialize the port. I think I
found one other disadvantage when I tried it, but I forget what it
was... I think LOC didn't work properly or something, making it
impossible to know how many characters are waiting in the recieve
buffer.



Tue, 23 Feb 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. COM3 and COM4 in QuickBasic

2. COM3 & COM4 in Quickbasic

3. PDS (Qbasic 7.1) and com3: & com4:

4. Ports COM3,COM4 in Qbasic.

5. Supporting Com3 and Com4 in QBasic

6. Supporting Com3 and Com4 in QBasic

7. problem whith com3, com4

8. VBDOS and COM3 & COM4

9. Accessing COM3 and COM4

10. Com3 in Quickbasic under Windows NT

11. QuickBasic 4.5 app need to convert to VB.net

12. Arrays with a TYPE in quickbasic 4.5

 

 
Powered by phpBB® Forum Software