blob: 00c0b952cb137b12b4df652b4994c9c989d1b86f [file] [log] [blame]
cliechtic1c37602009-07-21 01:34:57 +00001============
2 pyParallel
3============
4
5.. note:: This module is in development (since years ;-)
6
7Overview
8========
9This module encapsulates the access for the parallel port. It provides backends
10for Python running on Windows and Linux. Other platforms are possible too but
11not yet integrated.
12
13This module is still under development. But it may be useful for developers.
14
cliechti5134aab2009-07-21 19:47:59 +000015Copyright (C) 2001-2003 Chris Liechti <cliechti(at)gmx.net>
cliechtic1c37602009-07-21 01:34:57 +000016
17Here is the `project page on SourceForge`_ and here is the `SVN repository`_.
18
19.. _`project page on SourceForge`: http://sourceforge.net/projects/pyserial/
20.. _`SVN repository`: http://sourceforge.net/svn/?group_id=46487
21
22
23Features
24--------
25* same class based interface on all supported platforms
26* port numbering starts at zero, no need to know the port name in the user program
27* port string (device name) can be specified if access through numbering is inappropriate
28
cliechti5134aab2009-07-21 19:47:59 +000029
cliechtic1c37602009-07-21 01:34:57 +000030Requirements
31------------
32* Python 2.2 or newer
33* "Java Communications" (JavaComm) extension for Java/Jython
34
cliechti5134aab2009-07-21 19:47:59 +000035
cliechtic1c37602009-07-21 01:34:57 +000036Installation
37------------
38Extract files from the archive, open a shell/console in that directory and let
39Distutils do the rest: ``python setup.py install``
40
41The files get installed in the "Lib/site-packages" directory in newer Python versions.
42
43The windows version needs a compiled extension and the giveio.sys driver for
cliechti5134aab2009-07-21 19:47:59 +000044Windows NT/2k/XP. The extension module can be compiled with Distutils with
cliechtic1c37602009-07-21 01:34:57 +000045either MSVC or GCC/mingw32.
46
47It is released under a free software license, see LICENSE.txt for more details.
48
49
50Short introduction
51==================
52::
53
54 >>> import parallel
55 >>> p = parallel.Parallel() # open LPT1
56 >>> p.setData(0x55)
57
cliechti5134aab2009-07-21 19:47:59 +000058
cliechtic1c37602009-07-21 01:34:57 +000059Examples
60--------
61Please look in the SVN Repository. There is an example directory where you can
62find a simple terminal and more.
63http://pyserial.svn.sourceforge.net/viewvc/pyserial/trunk/pyparallel/examples/
64
cliechti5134aab2009-07-21 19:47:59 +000065
cliechti22978142009-07-21 01:58:11 +000066API
67===
68
69.. module:: parallel
70
71.. class:: Parallel
72
73 .. method:: __init__(port)
74
75 Open given parallel port.
76
77 .. method:: setData(value)
78
79 Apply the given byte to the data pins of the parallel port.
80
81 .. method:: setDataStrobe(level)
82
83 Set the "data strobe" line to the given state.
84
85 .. method:: setAutoFeed(level)
86
87 Set "auto feed" line to given state.
88
89 .. method:: setInitOut(level)
90
91 Set "initialize" line to given state.
92
93 .. method: setSelect(level)
94
95 Set "select" line to given state.
96
97 .. method:getInError()
98
99 Set "Error" line to given state.
100
101 .. method:: getInSelected()
102
103 Read level of "select" line.
104
105 .. method:: getInPaperOut()
106
107 Read level of "paper out" line.
108
109 .. method:: getInAcknowledge()
110
111 Read level of "Acknowledge" line.
112
113 .. method: getInBusy()
114
115 Read level of "busy" line.
116
cliechti5134aab2009-07-21 19:47:59 +0000117
cliechti22978142009-07-21 01:58:11 +0000118.. module:: parallel.parallelutil
119
120.. class:: BitaccessMeta
121
122 This mix-in class adds a few properties that allow easier bit access to the
123 data lines. (D0 .. D7) e.g. p.D0 refers to the first bit of the data
124 lines.
125
126.. class:: VirtualParallelPort
127
128 This class provides a virtual parallel port implementation, useful
129 for tests and simulations without real hardware.
130
131
cliechti88a552f2009-07-23 15:43:46 +0000132Notes
133=====
134
135Linux
136-----
1371. The :manpage:`lp(4)` module must be unloaded, ``rmmod lp``. ``lp`` claims
138 exclusive access to the port and other programs won't be able to use it.
139
1402. The :manpage:`ppdev(4)` module needs to be loaded, ``modprobe ppdev``. When
141 ``udev`` is in use, (default with 2.6 kernels) this will create a
142 ``/dev/parport0``.
143
1443. The user needs to have write permissions to ``/dev/parport0``. Many
145 distributions have an ``lp`` group that owns the device; the simplest is to
146 add the user account to this group. Simply changing permissions on the
147 device is not the best strategy as they will be reverted to their defaults
148 next time the driver is loaded.
149
150
151Windows
152-------
153The giveio driver must be installed as the module needs direct access to the
154hardware. This also means that USB parallel port adapters won't be supported.
155
156
cliechti22978142009-07-21 01:58:11 +0000157Misc
158====
cliechtic1c37602009-07-21 01:34:57 +0000159References
160----------
cliechti5134aab2009-07-21 19:47:59 +0000161* Python: http://www.python.org/
162* Jython: http://www.jython.org/
163* Java@IBM: http://www-106.ibm.com/developerworks/java/jdk/ (JavaComm links are
164 on the download page for the respective platform JDK)
165* Java@SUN: http://java.sun.com/products/