Com3 in Quickbasic under Windows NT 
Author Message
 Com3 in Quickbasic under Windows NT

I'm trying to open Com3 in QB4.5 that is running under Windows NT 4.0.  I've
tried the standard swapping of the com port addresses of Com1 and Com3 by
using POKE and then opening Com1 like:

DEF SEG 64
POKE &H00,&HE8
OPEN "COM1:2400,M,8,1"

but it doesn't work.  The address of Com1 does indeed become that of Com3,
but the port doesn't connect (hangs up trying to print to Com1).  I've also
tried some of the other code that I saw doing a deja news search on the
subject, all to no avail.

I have no trouble communicating with Com3 using Hyperterminal in Windows,
and if I plug the device into Com1 or Com2 I have no problem with it in
QB4.5.  Has anyone had any luck communicating with Com3 in NT?

Don



Sun, 25 Nov 2001 03:00:00 GMT  
 Com3 in Quickbasic under Windows NT
Personally, I don't know of anyway QuickBasic can work directly with COMs 3
and 4, but it sure can if you use interrupts. If I'm not mistaken it's int
14h for modems. Don't quote me, but I'll check it out and get back to you.
But I've had the same problem. My modem is on COM3. I have it so, (most of
my programming is done in assembly recently) it works fine w/COM3. It's been
a while, but doesn't QuickBasic have the 9600 buad limitation also?

--

Yours,

** leadGUITARIST for machineDEGENERATE **

Quote:

>I'm trying to open Com3 in QB4.5 that is running under Windows NT 4.0.
I've
>tried the standard swapping of the com port addresses of Com1 and Com3 by
>using POKE and then opening Com1 like:

>DEF SEG 64
>POKE &H00,&HE8
>OPEN "COM1:2400,M,8,1"

>but it doesn't work.  The address of Com1 does indeed become that of Com3,
>but the port doesn't connect (hangs up trying to print to Com1).  I've also
>tried some of the other code that I saw doing a deja news search on the
>subject, all to no avail.

>I have no trouble communicating with Com3 using Hyperterminal in Windows,
>and if I plug the device into Com1 or Com2 I have no problem with it in
>QB4.5.  Has anyone had any luck communicating with Com3 in NT?

>Don



Sun, 25 Nov 2001 03:00:00 GMT  
 Com3 in Quickbasic under Windows NT

Quote:
> Personally, I don't know of anyway QuickBasic can work directly with COMs 3
> and 4, but it sure can if you use interrupts. If I'm not mistaken it's int
> 14h for modems. Don't quote me, but I'll check it out and get back to you.
> But I've had the same problem. My modem is on COM3. I have it so, (most of
> my programming is done in assembly recently) it works fine w/COM3. It's been
> a while, but doesn't QuickBasic have the 9600 buad limitation also?

Although the help file states 9600, the actual limit is 19200.  The port
swapping trick does work under DOS, Win 3.x and 9x but NT has tighter control
over the hardware and won't allow it.  He could try powerbasic which allows the
port and interrupt to be specified in the OPEN statement.

Tom Lake
ICQ #25589135



Sun, 25 Nov 2001 03:00:00 GMT  
 Com3 in Quickbasic under Windows NT
You can also get any speed you want by first opening the com port then changing
some interrupt or something like that.  I found source code that let me access
it 155k, or whatever the fastest possible speed is.

Bob



Sun, 25 Nov 2001 03:00:00 GMT  
 Com3 in Quickbasic under Windows NT

Quote:

>> Personally, I don't know of anyway QuickBasic can work directly with COMs
3
>> and 4, but it sure can if you use interrupts. If I'm not mistaken it's
int
>> 14h for modems. Don't quote me, but I'll check it out and get back to
you.
>> But I've had the same problem. My modem is on COM3. I have it so, (most
of
>> my programming is done in assembly recently) it works fine w/COM3. It's
been
>> a while, but doesn't QuickBasic have the 9600 buad limitation also?

>Although the help file states 9600, the actual limit is 19200.  The port
>swapping trick does work under DOS, Win 3.x and 9x but NT has tighter
control
>over the hardware and won't allow it.  He could try PowerBASIC which allows
the
>port and interrupt to be specified in the OPEN statement.

>Tom Lake
>ICQ #25589135

"Address swapping" trick:

DEF SEG 64
POKE &H00,&HE8
OPEN "COM1:2400,N,8,1"

Well, I've reformatted the hard drive and installed Windows 95.  Guess what,
the port swapping trick still does not work.  Same problem as before with
NT.

It does change the address of com1 to be com3's address.  And I've verified
by looking at the registers that it is opening com1 (which is actually now
com3) properly.  But when I try to send a command to the device like:

PRINT #1, A$

The program hangs up and I'm hosed.  Why won't it let me send a command?



Mon, 26 Nov 2001 03:00:00 GMT  
 Com3 in Quickbasic under Windows NT
The 'swapping' thing is beyond me, but I would guess you would have to use
the interrupts to communicate with the modem. For instance, if I used int
10h (VIDEO) function 00h (i think) to change video modes to one that isn't
standard in QBasic, say mode 17h, QBasic has no commands to write text or
graphics to that screen. (pset() won't work) You have to use the int 10h
functions to do that, or work directly with the video RAM (0a000h is the
segment for a lot of modes). So look into those interrupts is all I can say.

--

Yours,

** leadGUITARIST for machineDEGENERATE **

Quote:

>"Address swapping" trick:

>DEF SEG 64
>POKE &H00,&HE8
>OPEN "COM1:2400,N,8,1"

>Well, I've reformatted the hard drive and installed Windows 95.  Guess
what,
>the port swapping trick still does not work.  Same problem as before with
>NT.

>It does change the address of com1 to be com3's address.  And I've verified
>by looking at the registers that it is opening com1 (which is actually now
>com3) properly.  But when I try to send a command to the device like:

>PRINT #1, A$

>The program hangs up and I'm hosed.  Why won't it let me send a command?



Mon, 26 Nov 2001 03:00:00 GMT  
 Com3 in Quickbasic under Windows NT

Quote:

>The 'swapping' thing is beyond me, but I would guess you would have to use
>the interrupts to communicate with the modem. For instance, if I used int
>10h (VIDEO) function 00h (i think) to change video modes to one that isn't
>standard in QBasic, say mode 17h, QBasic has no commands to write text or
>graphics to that screen. (pset() won't work) You have to use the int 10h
>functions to do that, or work directly with the video RAM (0a000h is the
>segment for a lot of modes). So look into those interrupts is all I can
say.

>--

>Yours,

>** leadGUITARIST for machineDEGENERATE **

I'm not trying to communicate with a modem.  I'm measuring a temperature
from a precision thermometer, then feeding a PID control algorithm signal to
a temperature control bath, then measuring a resistance when a certain
temperature condition is reached, then writing the data to a file.  So I'm
interfacing with three laboratory devices that have RS232 ports in order to
automate a precision, long-term test.

There's not much you can do with interrupts in QB45 to solve my com3
problem.  I gave up on QB45 for this.  I broke down and bought Power Basic
3.5 for DOS (thanks for the tip Tom Lake).  This is working, but barely
working.  I had to set the interrupt for com3 to IRQ15.  I'm able to write
to com3, but I still cannot read from com3.  Lucky for me I only need
one-way communication with one of the devices (the bath).

I could not get com3 to work with the standard IRQ4, even though I'd close
com1 prior to opening com3 (which also uses IRQ4).  The Powerbasic support
guy gave me something to try, which didn't work (he also said he couldn't
emulate my problem since he didn't have 3 com ports, which I felt was pretty
lame for a computer software support guy).  But since IRQ15 is doing the
job, the heck with it for now (maybe I'll figure it out later).

I'm very happy that Powerbasic has allowed me to perform the task at hand,
although working with it has led me to really appreciate the QB45 user
interface.  The PB user interface is pretty raw and the on-line help menu is
slim (although the manuals are comprehensive).  Also, I've found PB to be
more fickle to work with than QB45 with respect to having to clear buffers
and such.  You really need to make sure all your i's are dotted and t's are
crossed.

I have a feeling though that I will continue using PB instead of QB45 for
future programs, even where QB45 would work fine.  PB seems to offer a lot
more possibilites that I want to check out.



Sat, 01 Dec 2001 03:00:00 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. COM3 and COM4 in QuickBasic

2. COM3 & COM4 in Quickbasic

3. Com3 and Com4 from QuickBasic 4.5

4. Comm ports and running Quickbasic programs under windows or NT

5. QuickBasic program won't detect directories under NT

6. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

7. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

8. NT Service: An OLE Control for Creating Windows NT Services in Visual Basic (MSDN article)

9. If you are using Windows 95 or Windows NT

10. Word VBA - Windows to Windows NT compatibility

11. Use look and feel of Windows XP in Windows NT with VB6

12. Windows 2000 and windows NT in one machine

 

 
Powered by phpBB® Forum Software