Just basic/liberty basic problems

Hello all. I used to use qbasic to control the parallel port with OUT(888),255 type commands. I’ve recently picked up an new laptop with XP on it and now I’m using justbasic and liberty basic. I can no longer control the parallel port. Can anyone give me a working bit of code that will control pins 2-9 on and off ? Do I need special drivers ? Thanks, C Mitch

you have the basic idea, you need a driver.
this may help, lvr.com/parport.htm, about 2/3 of the way down the page is a section “Programming Tools for Port I/O and Interrupts” and the first entry is about a .dll called Inpout32.dll which I used an older version of some years ago. Don’t remember much more than that but it may be a start you can work from.

If you want to get user level access to the hardware on an XP machine, you can run Userport (at bottom link) on the machine one time and it sets the permissions to allow access just like a win 98 machine (qbasic should then work). Liberty basic should have a folder called ntport with the required dll and sys files to allow parallel port access. Link below has some parallel port post. Just basic does not have native ability for parallel port access, but the middle link below uses a userport work around along with debug to some simple parallel port pin toggling.

libertybasic.conforums.com/index … rd=comport
justbasic.conforums.com/index.cg … 1145483474
embeddedtronics.com/design&ideas.html

Liberty BASIC comes with the NTPORT driver that you need to make OUT and INP work, but you must make sure to install the software using an administrator account, and you may need to launch Liberty BASIC that way too.

Are you using XP Home, or XP Pro?

-Carl Gundel

XP pro. I got great control of my serial port but have yet to get control of the pport. I only run in administrator mode. I have the nt port driver in the right spot I think.

CLS
FOR counter = 1 TO 400
OUT 888,2
OUT 888,0
FOR zz = 1 TO 100: NEXT
NEXT counter

This is a sample of what I was trying. I’m starting to think maybe it might be my parallel cable. I kind of dropped this project and started working with serial control with the SSCII. I will post again after I get a new cable to test.

I think it was mentioned in another forum that a USB to parallel port “printer cable” will not work if that is what you are trying to use. Also, the code you posted will run extremely fast such that you may not be able to detect the pin changes. Below is example code from the help file. This loops 40,000 times and only takes 344 milliseconds (similar to your code). in your code the there is no delay between setting the pin high and setting it low. You may need to add a delay between the hi/lo pin changes if you are trying to interface with anything mechanical (bottom code).

[code]'get start time

startTime = time$(“ms”)

'do some computations

for i = 1 to 40000

x = x + i

next

'get end time

endTime=time$(“ms”)

print "Computations took ";

print endTime-startTime; " milliseconds"

end

[/code]

'get start time

startTime = time$("ms")

FOR counter = 1 TO 400
x=x+1 'OUT 888,2

  timer 10, [timertest]
  wait
[timertest]
  timer 0

y=y+1 'OUT 888,0
FOR zz = 1 TO 100: NEXT
NEXT counter

'get end time

endTime=time$("ms")

print "Computations took ";

print endTime-startTime; " milliseconds"

end