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 | |
cliechti | 5134aab | 2009-07-21 19:47:59 +0000 | [diff] [blame] | 15 | Copyright (C) 2001-2003 Chris Liechti <cliechti(at)gmx.net> |
cliechti | c1c3760 | 2009-07-21 01:34:57 +0000 | [diff] [blame] | 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 | |
cliechti | 5134aab | 2009-07-21 19:47:59 +0000 | [diff] [blame] | 29 | |
cliechti | c1c3760 | 2009-07-21 01:34:57 +0000 | [diff] [blame] | 30 | Requirements |
| 31 | ------------ |
| 32 | * Python 2.2 or newer |
| 33 | * "Java Communications" (JavaComm) extension for Java/Jython |
| 34 | |
cliechti | 5134aab | 2009-07-21 19:47:59 +0000 | [diff] [blame] | 35 | |
cliechti | c1c3760 | 2009-07-21 01:34:57 +0000 | [diff] [blame] | 36 | Installation |
| 37 | ------------ |
| 38 | Extract files from the archive, open a shell/console in that directory and let |
| 39 | Distutils do the rest: ``python setup.py install`` |
| 40 | |
| 41 | The files get installed in the "Lib/site-packages" directory in newer Python versions. |
| 42 | |
| 43 | The windows version needs a compiled extension and the giveio.sys driver for |
cliechti | 5134aab | 2009-07-21 19:47:59 +0000 | [diff] [blame] | 44 | Windows NT/2k/XP. The extension module can be compiled with Distutils with |
cliechti | c1c3760 | 2009-07-21 01:34:57 +0000 | [diff] [blame] | 45 | either MSVC or GCC/mingw32. |
| 46 | |
| 47 | It is released under a free software license, see LICENSE.txt for more details. |
| 48 | |
| 49 | |
| 50 | Short introduction |
| 51 | ================== |
| 52 | :: |
| 53 | |
| 54 | >>> import parallel |
| 55 | >>> p = parallel.Parallel() # open LPT1 |
| 56 | >>> p.setData(0x55) |
| 57 | |
cliechti | 5134aab | 2009-07-21 19:47:59 +0000 | [diff] [blame] | 58 | |
cliechti | c1c3760 | 2009-07-21 01:34:57 +0000 | [diff] [blame] | 59 | Examples |
| 60 | -------- |
| 61 | Please look in the SVN Repository. There is an example directory where you can |
| 62 | find a simple terminal and more. |
| 63 | http://pyserial.svn.sourceforge.net/viewvc/pyserial/trunk/pyparallel/examples/ |
| 64 | |
cliechti | 5134aab | 2009-07-21 19:47:59 +0000 | [diff] [blame] | 65 | |
cliechti | 2297814 | 2009-07-21 01:58:11 +0000 | [diff] [blame] | 66 | API |
| 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 | |
cliechti | 5134aab | 2009-07-21 19:47:59 +0000 | [diff] [blame] | 117 | |
cliechti | 2297814 | 2009-07-21 01:58:11 +0000 | [diff] [blame] | 118 | .. 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 | |
| 132 | Misc |
| 133 | ==== |
cliechti | c1c3760 | 2009-07-21 01:34:57 +0000 | [diff] [blame] | 134 | References |
| 135 | ---------- |
cliechti | 5134aab | 2009-07-21 19:47:59 +0000 | [diff] [blame] | 136 | * Python: http://www.python.org/ |
| 137 | * Jython: http://www.jython.org/ |
| 138 | * Java@IBM: http://www-106.ibm.com/developerworks/java/jdk/ (JavaComm links are |
| 139 | on the download page for the respective platform JDK) |
| 140 | * Java@SUN: http://java.sun.com/products/ |