Parallel port programming

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!

Moderators: Pete, Mods

Post Reply
pingiscoolest
Newbie
Posts: 4
Joined: Sun Dec 21, 2008 11:35 pm
Contact:

Parallel port programming

Post by pingiscoolest »

I have read some tutorials on how to program the parallel port in qbasic but cant seem to get it right. When I run the code:

OUT 888, 255
X = INP(888)
PRINT X


I always get the value 8. No matter what I set the port to. :( What am I doing wrong :?: Also the pins dont output the correct value. I know the parallel port works because I have downloaded programs that use the parallel port for interfacing and they have outputed the correct values. Thanks in advance.
Check out my website Pingiscoolest.weebly.net
User avatar
burger2227
Veteran
Posts: 2467
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Are you on an XP? XP blocks port access!

Get "PortTalk" available on the web for free. Follow install procedures. You can create a dummy EXE file to run with AllowIO.exe. Use the HEX address for your port listed in Windows hardware.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
pingiscoolest
Newbie
Posts: 4
Joined: Sun Dec 21, 2008 11:35 pm
Contact:

Post by pingiscoolest »

Ok thanks I'll try that for some reason I thought that was only nessacary in VB.
Check out my website Pingiscoolest.weebly.net
User avatar
burger2227
Veteran
Posts: 2467
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

VB does not have the INP or OUT functions, so you can use InpOut32 also free on the web.

Once PortTalk accesses a base port, you can use it until a reboot.

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
pingiscoolest
Newbie
Posts: 4
Joined: Sun Dec 21, 2008 11:35 pm
Contact:

Post by pingiscoolest »

I installed port talk but I still have the same problem, except I have realized that when I restart Qbasic the first command I send to the parallel port works but after that It always stays the same. For example if I first start Qbasic and type:

OUT 888, 111
X=INP(888)
PRINT X

Then I get 111, no matter how many times I run it. If I then change the code to

OUT 888, 255
X=INP(888)
PRINT X

I still get 111 every time. If I then restart Qbasic and type

OUT 888, 211
X=INP(888)
PRINT X

I get 211 but if I then change it to

OUT 888, 127
X=INP(888)
PRINT X

I still get 211. What am I doing wrong now?
Check out my website Pingiscoolest.weebly.net
User avatar
burger2227
Veteran
Posts: 2467
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

It has worked for me, but let me check it out after Xmas.

Did you put the driver file into the Windows\System32\drivers folder? You can also put it in the QB folder. Did you add the PortTalk.Reg to the registry? Widows will ask you to verify the edit!
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
pingiscoolest
Newbie
Posts: 4
Joined: Sun Dec 21, 2008 11:35 pm
Contact:

Post by pingiscoolest »

Yes Yes I did
Check out my website Pingiscoolest.weebly.net
User avatar
burger2227
Veteran
Posts: 2467
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

I have a simple program that can reverse the port and changes the base port data readout here:

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

Look for PPORT.ZIP and download that. There is a BAT file with the proper command line for PortTalk to run the PPORT.EXE program. It is already set for LPT 888. You should also see the Status (889) and Control (890) addresses. When the base port is accessed, you can also access those ports. 889 is Read only, but 888 and 890 are write and read. 890 normally reads 12.

When you are using the program just enter the number 32 to reverse the data port. When you enter any number below 32, the data will appear again, but it will also be increased by the program a bit. Some LPT ports are not reversable, but most newer ones are!

Do you have anything on the port?

Ted
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
Post Reply