Using Com3? 
Author Message
 Using Com3?

I use QuickBasic Extended Edition 7.0 with windows95.

My computer's modem uses COM 3 for its modem. Although
com1 and com2 will open fine with this code, Com3 produces an error.

open "com3:9600,N,8,1" for output as #1 ---> generates, "Bad FileName"
print #1, "ATDT phoneno"
close #1

Is there any way I could either change my modem's com port or
modify my code to support Com3?

Thanks for any replies.

--^alleycat



Wed, 06 Dec 2000 03:00:00 GMT  
 Using Com3?

a> I use QuickBasic Extended Edition 7.0 with windows95.

a> My computer's modem uses COM 3 for its modem. Although
a> com1 and com2 will open fine with this code, Com3 produces an error.

a> open "com3:9600,N,8,1" for output as #1 ---> generates, "Bad FileName"
a> print #1, "ATDT phoneno"
a> close #1

QuickBASIC doesn't support Com3. You can however tell it that Com3 is
Com1 and then probably get it to work that way. Although I'm not sure
how much of this Windows will let you get away with.

Try this. If it doesn't work, I have some other examples of Code. I
haven't tried this...I don't use Com3

Some Stuff From Fidonet

? Area: Quik_Bas ?????????????????????????????????????????????????????????????
  Msg#: 44                                           Date: 06-03-94  11:33
  From: Matt Hart                                    Read: Yes    Replied: No
    To: Alan Davenport                               Mark:                    
  Subj: Changing default interrup
??????????????????????????????????????????????????????????????????????????????
AD>I need information on how to change the default interrupts for COM ports. I

You swap the addresses for COM1 and COM2 with COM3 and COM4, then access
COM1 or COM2 and it will really be going to COM3 or COM4.  Like this:

SUB SwapCom1
    DEF SEG = &H40
    Com1.1 = PEEK(0)
    Com1.2 = PEEK(1)
    Com3.1 = PEEK(4)
    Com3.2 = PEEK(5)
    POKE 0,Com3.1
    POKE 1,Com3.2
    POKE 4,Com1.1
    POKE 5,Com1.2
    DEF SEG
END SUB

Com2 is peek/poke 2 & 3, Com4 is peek/poke 6 & 7.  Then:

CALL SwapCom1
OPEN "COM1" FOR BINARY AS 1    ' Buffer is actually COM3
CALL SwapCom1

    OR.......

'EXAMPLE: Accessing COM3: from QuickBASIC

        'move QuickBASIC segment pointer to BIOS data area
        DEF SEG=64
        'change com1: address in BIOS data area to com3:
        POKE &H00,&HE8
        'open com3: by issuing open com1: command
        OPEN "COM1:1200,N,8,1" FOR OUTPUT AS #1
        'print to comm port
        PRINT #1,"ATDT844-1212"
        'close comm port
        CLOSE #1
        'restore com1: address in BIOS data area to com1:
        POKE &H00,&HF8

Hope some of this helps.

pat DOT pridgen AT svis DOT org

*SignIt 2.x #001*
---
 t SPEED 2.00 #2289 t That "bug" took me two weeks of hard work to implement.

-----------------------------------------------------------------------------

This message was processed by Software Valley Information System
-----------------------------------------------------------------------------



Wed, 06 Dec 2000 03:00:00 GMT  
 Using Com3?

On 20 Jun 1998 19:23:50 GMT, "alleycat"

Quote:

>I use QuickBasic Extended Edition 7.0 with windows95.

>My computer's modem uses COM 3 for its modem. Although
>com1 and com2 will open fine with this code, Com3 produces an error.

>open "com3:9600,N,8,1" for output as #1 ---> generates, "Bad FileName"
>print #1, "ATDT phoneno"
>close #1

>Is there any way I could either change my modem's com port or
>modify my code to support Com3?

QB only supports COM1: and COM2: - other COM ports are not supported.
The only way around this is to poke the port address of COM3: to the memory
location of COM1: or COM2:, and then simply open COM1: -- this will now
point to COM3:, and hence you'll open COM3 instead.

However, you better make sure that the COM-port you 'fix' isn't used by
other applications at the same time, or weird things may occur.

View Memory location:

DEF SEG=&H40
PRINT HEX$(PEEK(1)) + HEX$(PEEK(0)): ' COM1:
PRINT HEX$(PEEK(3)) + HEX$(PEEK(2)): ' COM2:
PRINT HEX$(PEEK(5)) + HEX$(PEEK(4)): ' COM3:
PRINT HEX$(PEEK(7)) + HEX$(PEEK(5)): ' COM4:

Now, if you want to open COM3: from QB, all you have to do is PEEK it's
address from the COM3: location shown above, and POKE it into the location
that's occupied by COM1: or COM2:, whichever one you do not use.
--
Marc van den Dikkenberg
-----------------------
The powerbasic Archives
http://www.xs4all.nl/~excel/pb.html



Thu, 07 Dec 2000 03:00:00 GMT  
 Using Com3?



Quote:
> QuickBASIC doesn't support Com3. You can however tell it that Com3 is
> Com1 and then probably get it to work that way. Although I'm not sure
> how much of this Windows will let you get away with.

> Try this. If it doesn't work, I have some other examples of Code. I
> haven't tried this...I don't use Com3
> You swap the addresses for COM1 and COM2 with COM3 and COM4, then access
> COM1 or COM2 and it will really be going to COM3 or COM4.  Like this:

> 'EXAMPLE: Accessing COM3: from QuickBASIC

>         'move QuickBASIC segment pointer to BIOS data area
>         DEF SEG=64
>         'change com1: address in BIOS data area to com3:
>         POKE &H00,&HE8
>         'open com3: by issuing open com1: command
>         OPEN "COM1:1200,N,8,1" FOR OUTPUT AS #1
>         'print to comm port
>         PRINT #1,"ATDT844-1212"
>         'close comm port
>         CLOSE #1
>         'restore com1: address in BIOS data area to com1:
>         POKE &H00,&HF8

> Hope some of this helps.

Thank you very much for this code, but is there any way to
use Com2 for Com3 instead of Com1?
Com1 is my mouse port so I need to use com2.
After I am done using com3 can I change Com2 back to normal again?

Thanks for any replies,
--^alleycat



Fri, 08 Dec 2000 03:00:00 GMT  
 Using Com3?



Quote:
> QuickBASIC doesn't support Com3. You can however tell it that Com3 is
> Com1 and then probably get it to work that way. Although I'm not sure
> how much of this Windows will let you get away with.

> Try this. If it doesn't work, I have some other examples of Code. I
> haven't tried this...I don't use Com3
> You swap the addresses for COM1 and COM2 with COM3 and COM4, then access
> COM1 or COM2 and it will really be going to COM3 or COM4.  Like this:

> 'EXAMPLE: Accessing COM3: from QuickBASIC

>         'move QuickBASIC segment pointer to BIOS data area
>         DEF SEG=64
>         'change com1: address in BIOS data area to com3:
>         POKE &H00,&HE8
>         'open com3: by issuing open com1: command
>         OPEN "COM1:1200,N,8,1" FOR OUTPUT AS #1
>         'print to comm port
>         PRINT #1,"ATDT844-1212"
>         'close comm port
>         CLOSE #1
>         'restore com1: address in BIOS data area to com1:
>         POKE &H00,&HF8

> Hope some of this helps.

Thank you very much for this code, but is there any way to
use Com2 for Com3 instead of Com1?
Com1 is my mouse port so I need to use com2.
After I am done using com3 can I change Com2 back to normal again?

Thanks for any replies,
--^alleycat



Fri, 08 Dec 2000 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. !URGENT: MSComm using COM3 on a shared IRQ

2. Need to send a string to the serial COM3: port using VBA

3. Data to COM3 from BASIC?

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

5. Problem wth vb6 and MSCOMM and com3

6. Com3 in Quickbasic under Windows NT

7. Opening Com3 ??

8. Ports COM3,COM4 in Qbasic.

9. Supporting Com3 and Com4 in QBasic

10. Supporting Com3 and Com4 in QBasic

11. COM3 and COM4 in QuickBasic

12. COM3 & COM4 in Quickbasic

 

 
Powered by phpBB® Forum Software