Page 1 of 1

QBasic communication through COM1 port? (reader question)

Posted: Thu Nov 13, 2008 4:48 pm
by Pete
Question from QB Express reader Eric:

Hi Pete,

I am going to try to use Qbasic to talk to a piece of equipment through the COM1 port via RS232. I did this may years ago but I have forgot how to do this. I will need to both read and write information. Can you tell me the correct command, format and if I need to do any variable setups.

Thanks,
Eric

Posted: Thu Nov 13, 2008 5:22 pm
by burger2227
There are a couple of ways to deal with COM ports in QB. You can use the OPEN COM1 statement and use LOC(1) to find if data was received, INPUT$(1, bytes) to read the data, and PRINT #1 to transmit data.

You could also use INP and OUT to deal directly with the COM port address registers. I have a tutorial called Q-Basics.Zip at:

http://www.qbasicstation.com/index.php? ... &filecat=3

Scroll down to find it and download. Check Chapter 11 for port programming. If you use NT or XP you may need PortTalk (free on web).
Read the PortTalk install procedure and useage to allow a port address acess!

Ted

Porttalk

Posted: Fri Nov 14, 2008 9:33 pm
by Dav
Hey, that Qbasic/PortTalk package looks interesting. Thanks for the link.

NOTE!

Posted: Mon Nov 17, 2008 6:31 pm
by burger2227
One note of caution about PortTalk.

If you do not designate a port address, it may cause your mouse to quit working! Without a port address, it opens all ports for access, shutting off the mouse perhaps.

Welcome Dav,

Ted