cliechti | c1c3760 | 2009-07-21 01:34:57 +0000 | [diff] [blame] | 1 | ============ |
| 2 | pyParallel |
| 3 | ============ |
| 4 | |
| 5 | .. note:: This module is in development (since years ;-) |
| 6 | |
| 7 | Overview |
| 8 | ======== |
| 9 | This module encapsulates the access for the parallel port. It provides backends |
| 10 | for Python running on Windows and Linux. Other platforms are possible too but |
| 11 | not yet integrated. |
| 12 | |
| 13 | This module is still under development. But it may be useful for developers. |
| 14 | |
| 15 | (C) 2001-2003 Chris Liechti <cliechti@gmx.net> |
| 16 | |
| 17 | Here 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 | |
| 23 | Features |
| 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 | |
| 29 | Requirements |
| 30 | ------------ |
| 31 | * Python 2.2 or newer |
| 32 | * "Java Communications" (JavaComm) extension for Java/Jython |
| 33 | |
| 34 | Installation |
| 35 | ------------ |
| 36 | Extract files from the archive, open a shell/console in that directory and let |
| 37 | Distutils do the rest: ``python setup.py install`` |
| 38 | |
| 39 | The files get installed in the "Lib/site-packages" directory in newer Python versions. |
| 40 | |
| 41 | The windows version needs a compiled extension and the giveio.sys driver for |
| 42 | Windows NT/2k/XP. The extension module can be compiled with distutils with |
| 43 | either MSVC or GCC/mingw32. |
| 44 | |
| 45 | It is released under a free software license, see LICENSE.txt for more details. |
| 46 | |
| 47 | |
| 48 | Short introduction |
| 49 | ================== |
| 50 | :: |
| 51 | |
| 52 | >>> import parallel |
| 53 | >>> p = parallel.Parallel() # open LPT1 |
| 54 | >>> p.setData(0x55) |
| 55 | |
| 56 | Examples |
| 57 | -------- |
| 58 | Please look in the SVN Repository. There is an example directory where you can |
| 59 | find a simple terminal and more. |
| 60 | http://pyserial.svn.sourceforge.net/viewvc/pyserial/trunk/pyparallel/examples/ |
| 61 | |
cliechti | 2297814 | 2009-07-21 01:58:11 +0000 | [diff] [blame] | 62 | API |
| 63 | === |
| 64 | |
| 65 | .. module:: parallel |
| 66 | |
| 67 | .. class:: Parallel |
| 68 | |
| 69 | .. method:: __init__(port) |
| 70 | |
| 71 | Open given parallel port. |
| 72 | |
| 73 | .. method:: setData(value) |
| 74 | |
| 75 | Apply the given byte to the data pins of the parallel port. |
| 76 | |
| 77 | .. method:: setDataStrobe(level) |
| 78 | |
| 79 | Set the "data strobe" line to the given state. |
| 80 | |
| 81 | .. method:: setAutoFeed(level) |
| 82 | |
| 83 | Set "auto feed" line to given state. |
| 84 | |
| 85 | .. method:: setInitOut(level) |
| 86 | |
| 87 | Set "initialize" line to given state. |
| 88 | |
| 89 | .. method: setSelect(level) |
| 90 | |
| 91 | Set "select" line to given state. |
| 92 | |
| 93 | .. method:getInError() |
| 94 | |
| 95 | Set "Error" line to given state. |
| 96 | |
| 97 | .. method:: getInSelected() |
| 98 | |
| 99 | Read level of "select" line. |
| 100 | |
| 101 | .. method:: getInPaperOut() |
| 102 | |
| 103 | Read level of "paper out" line. |
| 104 | |
| 105 | .. method:: getInAcknowledge() |
| 106 | |
| 107 | Read level of "Acknowledge" line. |
| 108 | |
| 109 | .. method: getInBusy() |
| 110 | |
| 111 | Read level of "busy" line. |
| 112 | |
| 113 | .. module:: parallel.parallelutil |
| 114 | |
| 115 | .. class:: BitaccessMeta |
| 116 | |
| 117 | This mix-in class adds a few properties that allow easier bit access to the |
| 118 | data lines. (D0 .. D7) e.g. p.D0 refers to the first bit of the data |
| 119 | lines. |
| 120 | |
| 121 | .. class:: VirtualParallelPort |
| 122 | |
| 123 | This class provides a virtual parallel port implementation, useful |
| 124 | for tests and simulations without real hardware. |
| 125 | |
| 126 | |
| 127 | Misc |
| 128 | ==== |
cliechti | c1c3760 | 2009-07-21 01:34:57 +0000 | [diff] [blame] | 129 | References |
| 130 | ---------- |
| 131 | * Python: http://www.python.org/|http://www.python.org |
| 132 | * Jython: http://www.jython.org/|http://www.jython.org |
| 133 | * Java@IBM http://www-106.ibm.com/developerworks/java/jdk/ (JavaComm links are on the download page for the respective platform jdk) |
| 134 | * Java@SUN http://java.sun.com/products/ |