Bit by bit parallel port control
Hi Everyone,
I'm having problems controlling the parallel port on a bit-on bit-off basis for a relay switch on a control project.
Linux marmot 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 athlon i386 GNU/Linux
I have tried using the /dev/port method and putb - I can seemingly set bits on the port OK. However, checking with a meter shows the line changing for a few milliseconds then returning to 0v. I need the levels to hold. I believe that's what SHOULD happen...
I figured the lp module may interfere, so removed that. No help. Currently lsmod shows:
w83781d 26240 0 i2c_sensor 2176 1 w83781d i2c_amd756 4484 0 i2c_core 16388 3 w83781d,i2c_sensor,i2c_amd756 autofs4 10624 0 sunrpc 101064 1 forcedeth 10624 0 floppy 47440 0 sg 27552 0 scsi_mod 91344 1 sg dm_mod 33184 0 ati_remote 9228 0 ohci_hcd 14748 0 button 4504 0 battery 6924 0 asus_acpi 8472 0 ac 3340 0 ext3 102376 3 jbd 40216 1 ext3
Board is an ASUS A72N266VM (nforce based). Build is fedora 2. I'm not running lpd or X etc. Any suggestions?
There's plenty of sample code around, so I'm pretty confident I'm doing things right. My test code is here :
http://www.i-r-genius.com/paralleltest.c
I suspect there's something odd going on. I aim to try the code on an older machine soon.
Any help or pointers appreciated,
--
Tony
On Mon, 2004-10-11 15:10:13 +0100, Tony Howat <[email protected]> wrote in message <[email protected]>:
Quoted 4 lines
I have tried using the
/dev/portmethod and putb - I can seemingly set bits on the port OK. However, checking with a meter shows the line changing for a few milliseconds then returning to 0v. I need the levels to hold. I believe that's what SHOULD happen...
Don't mess with the hardware on your own! That's almost always a bug and will cost you any later portability. Instead, just use the interface
Please use the userspace parport driver interface (provided by ppdev.ko). Additionally it'll give you full portability to non-PC hardware for free:-)
Quoted 4 lines
There's plenty of sample code around, so I'm pretty confident I'm doing things right. My test code is here :
Not all that right:-) You access the hardware directly which is wrong. Use the ppdev interface instead.
I've just put the program online
(http://lug-owl.de/~jbglaw/software/steckdose/steckdose.c) which drives my relay box (basically a shift register + relay driver).
I guess the parport locking code isn't yet correct, but it should give you a start to using ppdev...
MfG, JBG
Signature · 4 lines
Jan-Benedict Glaw [email protected] . +49-172-7608481 _ O _ "Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));