Page 1 of 1

Parallel port programming

Posted: Sun Dec 21, 2008 11:44 pm
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.

Posted: Mon Dec 22, 2008 2:00 pm
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

Posted: Tue Dec 23, 2008 10:21 am
by pingiscoolest
Ok thanks I'll try that for some reason I thought that was only nessacary in VB.

Posted: Tue Dec 23, 2008 12:24 pm
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

Posted: Wed Dec 24, 2008 4:43 pm
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?

Posted: Thu Dec 25, 2008 2:32 am
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!

Posted: Thu Dec 25, 2008 9:44 am
by pingiscoolest
Yes Yes I did

Posted: Thu Dec 25, 2008 5:37 pm
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