How to Directly Control Parallel Port Pins in Puppy?

What works, and doesn't, for you. Be specific, and please include Puppy version.
Post Reply
Message
Author
zunkthehorrible
Posts: 1
Joined: Sat 28 Oct 2006, 13:22
Location: Toronto Canada

How to Directly Control Parallel Port Pins in Puppy?

#1 Post by zunkthehorrible »

Greetings,
I have been teaching the Puppy OS to my grade 12 Computer Engineering class (1st time - worked well) and would like to continue using this OS for the "Controlling Real World Devices" section of the course, but doing so requires that I can directly control the pins on the parallel port (and serial too would be nice)... Does anyone know of a way of doing this?

May the Puppy never pee on your leg,

Zunk

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#2 Post by Flash »

I suppose this would come under the heading of Device Drivers. I believe it's been mentioned in the forum before. I can't remember where, exactly.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#3 Post by MU »

in my german board once a Perl/Cgi program for the webbrowser was posted, to control a 8 chanel interface via the parallel-port.

Sourcecode:
http://f24.parsimony.net/forum54930/messages/18666.htm

description (german):
http://f24.parsimony.net/forum54930/messages/18632.htm

Even if you don't talk german, the source is interesting, as it shows how to use the printerport from Perl.

important is this part to send data:

Code: Select all

 if (open(INTERFACE, ">/dev/lp0")) #Wenn es geht auf das Interface schreiben
{
print INTERFACE chr( $Data[0] + $Data[1]*2 + $Data[2]*4 + $Data[3]*8 + $Data[4]*16 + $Data[5]*32 + $Data[6]*64 + $Data[7]*128);
close(INTERFACE);
print $Kanalnummer, $Zustand =~ 0 ? " ausgeschaltet<br>\n" : " eingeschaltet<br>\n";
}

else #Fehlermeldung
{
print "nicht umschalten k&ouml;nnen<br>\nAuf das Interface konnte nicht zugegriffen werden!<br>\n<br>\n";
}

} 

Mark

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#4 Post by GuestToo »

someone wanted to be able to access ports as it was done in qbasic/quickbasic

FreeBASIC's syntax is designed to be close to quickbasic

the sound example on this page seems to work on my machine ... that is, it seems to sending data to the ports on my machine

if i run the program as user "spot", it doesn't work, which is what should happen if you are accessing the ports directly (unless you use ioperm)

so FreeBASIC should be a simple and easy way to access ports directly from Linux

FreeBASIC requires the devx compiling environment (gcc) to be installed ... FreeBASIC compiles basic source and produces compiled binary executables

search the FreeBASIC forum ... for example, a program that monitors the parallel port

Retroforth is supposed to have support for serial and parallel ports, i think ... i don't know if it does, or what the syntax would be, it does not seem to have a lot of documentation ... Retroforth is tiny, about 13k, with no dependencies (statically linked), does not depend on gcc

Reva Forth is similar to RetroForth ... it's written mostly in assembler, so it's a little bigger (about 27k) but faster ... it might be able to access ports from Linux

of course, you can write programs in C and other languages

there should be device drivers for the parallel ports and the serial ports already installed ... the first parallel port is /dev/parport0 and the first serial port is /dev/ttyS0 ... you can read and write directly from a Linux device as if it is a file ... for example, echo 'xyz' > /dev/parport0

GuestToo
Puppy Master
Posts: 4083
Joined: Wed 04 May 2005, 18:11

#5 Post by GuestToo »



muggins
Posts: 6724
Joined: Fri 20 Jan 2006, 10:44
Location: hobart

#7 Post by muggins »

two links where forth is used for // port interfacing:

ftp://ccreweb.org/software/kforth/examples/adio.4th

http://www.forth.org/fd/Step.html

Post Reply