Page 1 of 1

COM port control - Need help!

Posted: Thu Jul 14, 2005 4:53 pm
by Patz QuickBASIC Creations
Hello! It's been a while since I've been on...
Anyway, I need help using the COM ports. I am testing using QBasic, but I usually use PDS. I need help on sending values from a COM port to another computer. It's a basic program, but I can't figure out how to send out to a COM port. Any and all help would be appreciated. Thanks.

PATZ
Patz QuickBasic Creations


P.S. - The program sends ASC values from a COM port and another computer recieves them and shows the character on the screen. MY IDEA!!! PATENTED!!!

Posted: Thu Jul 14, 2005 5:02 pm
by MystikShadows
Hi there,

You can open the com port much like you open a file using the OPEN statement. The help file in the PDS or any QB should detail it quite nicely for you :-). just see about the OPEN statement.

Hope this helps.

Posted: Thu Jul 14, 2005 5:07 pm
by Patz QuickBASIC Creations
woah... fast reply...
Anyway, I'm in the middle of a move, and my computer with PDS is currently packed. That's why I'm using QBasic right now. (I don't usually mess with libraries - I have Future 3 for PDS) Is it possible to do this in QBasic? I would like to get it running as soon as possible.

Also, is there amy sort of program that can tell what your COM port codes are?

Posted: Thu Jul 14, 2005 5:19 pm
by MystikShadows
Yup QBasic should do it just as good as PDS.

As for the com port codes? what do you mean, the physical address? Or the kind of code you can send?

If you go to your BIOS settings, com ports should be in there somewhere.

Typically com1 is $03f8 but you should only need to open "COM1:" not the address itself. :-)

Posted: Thu Jul 14, 2005 5:30 pm
by Patz QuickBASIC Creations
The example in QBasic reads:
OUT port%, data%
- port% A number in the range 0 65535 that identifies the port
- data% A numeric expression to send to the port

Example:
x% = INP(&H3FC) <These confuse me
OUT &H3FC, (x% XOR 1)

So... I know what to do for the data% and what for the recieving side (COM trapping), but I can't send. Maybe PDS would work better for this.
And, to me, the OPEN COM statement makes no sense...

P.S. MystikShadows, ASCII-WORLD rocks! I just sent a contribution. I hope it becomes one of the great sites. Good Luck!

Posted: Thu Jul 14, 2005 7:02 pm
by MystikShadows
Excellent :-).....I see a few in there, what's the file name so I can sort it out and put it in it's rightful ASCII world section? :-)

Posted: Fri Jul 15, 2005 12:05 am
by Moochthemonkey
x% = INP(&H3FC) <These confuse me
Simply what is happening here is INP records the data at the address(&H3FC) and stores it in x%...

Besides, reading from the COM is a lot harder than it sounds...I originally tried to get this working with a PDA I had but got nothing working..

Posted: Fri Jul 15, 2005 5:51 am
by Antoni
Usually the COM ports are accessed as files, with OPEN, PRINT # and INPUT #. Why are you doing it the hard way?
Comm ports are the same in QB and in PDS

This should help http://faq.qbasicnews.com/?blast=SerialComms

Posted: Fri Jul 15, 2005 3:12 pm
by Sum Yung Guy
If you go to the tutorials section of petesqbsite, you should find Helppc, a MS-DOS App which has all the base addresses in your computer

Posted: Fri Jul 15, 2005 3:14 pm
by Guest
Antoni wrote:Usually the COM ports are accessed as files, with OPEN, PRINT # and INPUT #. Why are you doing it the hard way?
Comm ports are the same in QB and in PDS

This should help http://faq.qbasicnews.com/?blast=SerialComms
Yes, I remember when you gave that to me a while ago. What's basically throwing me off is the damn protocol.

Posted: Fri Jul 15, 2005 10:10 pm
by Guest
And that was me by the way, I don't know why it showed me as a guest. ^