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
How to Directly Control Parallel Port Pins in Puppy?
-
- Posts: 1
- Joined: Sat 28 Oct 2006, 13:22
- Location: Toronto Canada
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:
Mark
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önnen<br>\nAuf das Interface konnte nicht zugegriffen werden!<br>\n<br>\n";
}
}
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
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
two links where forth is used for // port interfacing:
ftp://ccreweb.org/software/kforth/examples/adio.4th
http://www.forth.org/fd/Step.html
ftp://ccreweb.org/software/kforth/examples/adio.4th
http://www.forth.org/fd/Step.html