Log in

View Full Version : Accessing paralel port


[527]phil
24-07-2005, 21:01
Ok so I started on a small robot that i'm going to control using an old toshiba satalite laptop. I know how to use the parallel port to hook it up. I'm trying to program it in BASIC but i don't know how to send information through the parallel port. What I DO know is that i have to send data bits, eight in total. If I send a 0 it will trigger something off, if I send a 1 it will trigger it on. But how do I send data through a particular port using BASIC language?

Timothy D. Ginn
24-07-2005, 22:46
phil']Ok so I started on a small robot that i'm going to control using an old toshiba satalite laptop. I know how to use the parallel port to hook it up. I'm trying to program it in BASIC but i don't know how to send information through the parallel port. What I DO know is that i have to send data bits, eight in total. If I send a 0 it will trigger something off, if I send a 1 it will trigger it on. But how do I send data through a particular port using BASIC language?

See: http://ourworld.compuserve.com/homepages/Bill_Bowden/page6.htm (it's got some QBASIC code for reading from the parallel port, and does have some mention of using the OUT command for sending data rather than the INP command for reading it.

Tristan Lall
25-07-2005, 00:38
What's the operating system of the laptop? In DOS-based operating systems (e.g. MS-DOS 6.22, Windows 95, Windows Me) you can access the parallel port directly using the language's I/O port routines (I know, for example, that Pascal allows you to write to Port[$387] for LPT1, or to run inline assembly routines). With Windows NT-based operating systems (e.g. Windows NT 4.0, Windows 2000, Windows XP), you need to use some driver that provides the appropriate access routines—it's more difficult, but also more robust. If it's not Windows or DOS, I wouldn't know.

Try this (http://www.repairfaq.org/filipg/LINK/PORTS/F_PARALLEL2.html#PARALLEL_007) for some information on parallel ports under a DOS-based system (in Pascal, but easy to understand).

[527]phil
25-07-2005, 07:56
The laptop is running windows 98 SE. But the first page helped and right now I have 6 LED's chasing each other when I let go of a micro switch.

Joe Johnson
25-07-2005, 08:01
This Kit (http://kitsrus.com/kits.html#k93) from kitsrus.com (available here (http://www.electronics123.com/s.nl?sc=14&search=k93)) uses the parallel port on a PC as a cheap "Data Acquistion"

The interesting bit for the purposes of this thread is that this document (http://lib1.store.vip.sc5.yahoo.com/lib/webtronics/kit93.pdf) has a discussion of IO via the printer port (addresses, which pins do what, how to read from the port, how to write to it, etc.) . It has BASIC code examples (though they are specific to the particular IO box, if you know a bit about the chips used on the board, you can pretty much follow what is going on).

Good luck.

Joe J.