* Automatically exclude the pin for switchable backlight from keypad scanning

in the 4bit and 8bit wiring. This fixes problems with flickering backlight if
  a slow parallel port is used. IMPORTANT: This may require a hardware change!
* In code comments use the same line names as in the user's guide (Y1/X1
  instead of Y0/X0).
* Add documentation about hd44780-ftdi's 4bit mode.
This commit is contained in:
mmdolze
2010-01-18 22:24:59 +00:00
parent 6fba5cef68
commit 59f3cbdb45
6 changed files with 208 additions and 64 deletions
+1
View File
@@ -19,6 +19,7 @@ v.0.5dev (ongoing development)
* Modify serial drivers to use cfmakeraw * Modify serial drivers to use cfmakeraw
+ hd44780: Add a 'none' charmap which does not replace any character + hd44780: Add a 'none' charmap which does not replace any character
* hd44780: Change mapping for spanish 'n with tilde' characters * hd44780: Change mapping for spanish 'n with tilde' characters
* hd44780: Exclude pin for switchable backlight from keypad scanning
v0.5.3 v0.5.3
+ lcdexec: notification when called program finishes + lcdexec: notification when called program finishes
+122 -2
View File
@@ -827,6 +827,7 @@ The optional keypad can be connected as follows:
<entry namest="lpt1" nameend="lpt2" align="center">printer port</entry> <entry namest="lpt1" nameend="lpt2" align="center">printer port</entry>
<entry morerows="1">&lt;-&gt;</entry> <entry morerows="1">&lt;-&gt;</entry>
<entry align="center">keypad</entry> <entry align="center">keypad</entry>
<entry morerows="1">remarks</entry>
</row> </row>
<row> <row>
<entry>name</entry> <entry>name</entry>
@@ -840,42 +841,49 @@ The optional keypad can be connected as follows:
<entry>2</entry> <entry>2</entry>
<entry></entry> <entry></entry>
<entry>Y<subscript>1</subscript></entry> <entry>Y<subscript>1</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>D1</entry> <entry>D1</entry>
<entry>3</entry> <entry>3</entry>
<entry></entry> <entry></entry>
<entry>Y<subscript>2</subscript></entry> <entry>Y<subscript>2</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>D2</entry> <entry>D2</entry>
<entry>4</entry> <entry>4</entry>
<entry></entry> <entry></entry>
<entry>Y<subscript>3</subscript></entry> <entry>Y<subscript>3</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>D3</entry> <entry>D3</entry>
<entry>5</entry> <entry>5</entry>
<entry></entry> <entry></entry>
<entry>Y<subscript>4</subscript></entry> <entry>Y<subscript>4</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>D4</entry> <entry>D4</entry>
<entry>6</entry> <entry>6</entry>
<entry></entry> <entry></entry>
<entry>Y<subscript>5</subscript></entry> <entry>Y<subscript>5</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>D5</entry> <entry>D5</entry>
<entry>7</entry> <entry>7</entry>
<entry></entry> <entry></entry>
<entry>Y<subscript>6</subscript></entry> <entry>Y<subscript>6</subscript></entry>
<entry>Only if not used for backlight or 3<superscript>rd</superscript> controller.</entry>
</row> </row>
<row> <row>
<entry>nSTRB</entry> <entry>nSTRB</entry>
<entry>1</entry> <entry>1</entry>
<entry></entry> <entry></entry>
<entry>Y<subscript>7</subscript></entry> <entry>Y<subscript>7</subscript></entry>
<entry morerows="3">Only if not used for additional controllers.</entry>
</row> </row>
<row> <row>
<entry>nLF</entry> <entry>nLF</entry>
@@ -900,30 +908,35 @@ The optional keypad can be connected as follows:
<entry>10</entry> <entry>10</entry>
<entry></entry> <entry></entry>
<entry>X<subscript>1</subscript></entry> <entry>X<subscript>1</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>BUSY</entry> <entry>BUSY</entry>
<entry>11</entry> <entry>11</entry>
<entry></entry> <entry></entry>
<entry>X<subscript>2</subscript></entry> <entry>X<subscript>2</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>PAPEREND</entry> <entry>PAPEREND</entry>
<entry>12</entry> <entry>12</entry>
<entry></entry> <entry></entry>
<entry>X<subscript>3</subscript></entry> <entry>X<subscript>3</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>SELIN</entry> <entry>SELIN</entry>
<entry>13</entry> <entry>13</entry>
<entry></entry> <entry></entry>
<entry>X<subscript>4</subscript></entry> <entry>X<subscript>4</subscript></entry>
<entry></entry>
</row> </row>
<row> <row>
<entry>nFAULT</entry> <entry>nFAULT</entry>
<entry>15</entry> <entry>15</entry>
<entry></entry> <entry></entry>
<entry>X<subscript>5</subscript></entry> <entry>X<subscript>5</subscript></entry>
<entry></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
@@ -1407,7 +1420,7 @@ The optional keypad can be connected as follows:
<entry>nSEL</entry> <entry>nSEL</entry>
<entry>17</entry> <entry>17</entry>
<entry></entry> <entry></entry>
<entry>Y<subscript>10</subscript></entry> <entry>Y<subscript>10</subscript> (only if not used for backlight)</entry>
</row> </row>
<row> <row>
<entry>nACK</entry> <entry>nACK</entry>
@@ -1858,6 +1871,106 @@ The wiring of the control lines can optionally be reconfigured,
please look at the driver source if you really need that. please look at the driver source if you really need that.
</para> </para>
<para>
Alternatively you can use a single channel FTDI FT245BM USB &lt;-&gt; parallel
FIFO chip and use the display in its 4 bit mode.
</para>
<table id="hd44780-ftdi.4bit-mapping">
<title>HD44780: 4bit FTDI</title>
<tgroup cols="5" align="left">
<colspec colname="ftdi1"/>
<colspec colname="ftdi2" align="right"/>
<colspec colname="base" align="center"/>
<colspec colname="lcd1"/>
<colspec colname="lcd2"/>
<thead>
<row>
<entry namest="ftdi1" nameend="ftdi2" align="center">FTDI chip</entry>
<entry morerows="1">&lt;-&gt;</entry>
<entry namest="lcd1" nameend="lcd2" align="center">LCD</entry>
</row>
<row>
<entry>name</entry>
<entry>pin</entry>
<entry>name</entry>
<entry>pin</entry>
</row>
</thead>
<tbody>
<row>
<entry>D0</entry>
<entry>25</entry>
<entry></entry>
<entry>D4</entry>
<entry>11</entry>
</row>
<row>
<entry>D1</entry>
<entry>24</entry>
<entry></entry>
<entry>D5</entry>
<entry>12</entry>
</row>
<row>
<entry>D2</entry>
<entry>23</entry>
<entry></entry>
<entry>D6</entry>
<entry>13</entry>
</row>
<row>
<entry>D3</entry>
<entry>22</entry>
<entry></entry>
<entry>D7</entry>
<entry>14</entry>
</row>
<row>
<entry>D4</entry>
<entry>21</entry>
<entry></entry>
<entry>EN</entry>
<entry>6</entry>
</row>
<row>
<entry>D5</entry>
<entry>20</entry>
<entry></entry>
<entry>RS</entry>
<entry>4</entry>
</row>
<row>
<entry>D6</entry>
<entry>19</entry>
<entry></entry>
<entry>RW</entry>
<entry>5</entry>
</row>
</tbody>
</tgroup>
</table>
<para>
The following special configuration settings are required to use a single
channel FTDI FIFO chip:
</para>
<example id="hd44780-ftdi-4bit-config.example">
<title>HD44780: Configuration for FTDI 4bit</title>
<screen>
<![CDATA[
[hd44780]
ConnectionType=ftdi
ftdi_mode=4
ftdi_line_RS=0x40
ftdi_line_RW=0x20
ftdi_line_EN=0x10
]]>
</screen>
</example>
</sect3> </sect3>
<sect3 id="hd44780-lis2"> <sect3 id="hd44780-lis2">
@@ -2706,7 +2819,8 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
<emphasis><parameter><literal>hd44780_default</literal></parameter></emphasis> | <emphasis><parameter><literal>hd44780_default</literal></parameter></emphasis> |
<parameter><literal>hd44780_euro</literal></parameter> | <parameter><literal>hd44780_euro</literal></parameter> |
<parameter><literal>ea_ks0073</literal></parameter> | <parameter><literal>ea_ks0073</literal></parameter> |
<parameter><literal>sed12780f_0b</literal></parameter> <parameter><literal>sed12780f_0b</literal></parameter> |
<parameter><literal>none</literal></parameter>
} }
</term> </term>
<listitem><para> <listitem><para>
@@ -2729,6 +2843,12 @@ This can be done by specifying <option>--enable-drivers=all</option> or by inclu
<listitem><para> <listitem><para>
<literal>sed12780f_0b</literal> is for some SED 1278 displays. <literal>sed12780f_0b</literal> is for some SED 1278 displays.
</para></listitem> </para></listitem>
<listitem><para>
The <literal>none</literal> charmap does not translate any characters.
It displays the characters the display controllers actually has
stored in its CGROM for that position instead. This setting is
intended for debugging purpose.
</para></listitem>
</itemizedlist> </itemizedlist>
You only need to set this parameter if you have a non-standard You only need to set this parameter if you have a non-standard
HD44780 display. HD44780 display.
+39 -16
View File
@@ -34,19 +34,29 @@
* Keypad connection (optional): * Keypad connection (optional):
* Some diodes and resistors are needed, see further documentation. * Some diodes and resistors are needed, see further documentation.
* printer port keypad * printer port keypad
* D0 (2) Y0 * D0 (2) Y1
* D1 (3) Y1 * D1 (3) Y2
* D2 (4) Y2 * D2 (4) Y3
* D3 (5) Y3 * D3 (5) Y4
* D4 (6) Y4 * D4 (6) Y5
* D5 (7) Y5 *
* With a backlight or three displays, 4 additional rows are possible:
* nSTRB (1) Y6 * nSTRB (1) Y6
* nLF (14) Y7 * nLF (14) Y7
* INIT (16) Y8 * INIT (16) Y8
* nSEL (17) Y9 * nSEL (17) Y9
*
* With only two controllers and no backlight, 5 additional rows are possible:
* D5 (7) Y6
* nSTRB (1) Y7
* nLF (14) Y8
* INIT (16) Y9
* nSEL (17) Y10
*
* Colums return lines are the same for all configurations:
* nACK (10) X0 * nACK (10) X0
* BUSY (11) X1 * BUSY (11) X1
* PAPEREND (12 X2 * PAPEREND (12) X2
* SELIN (13) X3 * SELIN (13) X3
* nFAULT (15) X4 * nFAULT (15) X4
* *
@@ -125,7 +135,7 @@ hd_init_4bit(Driver *drvthis)
port_out(p->port, 0x03); port_out(p->port, 0x03);
if (p->delayBus) hd44780_functions->uPause(p, 1); if (p->delayBus) hd44780_functions->uPause(p, 1);
/* We'll now send 0x03 a coulpe of times, /* We'll now send 0x03 a coulpe of times,
* which is in fact (FUNCSET | IF_8BIT) >> 4 */ * which is in fact (FUNCSET | IF_8BIT) >> 4 */
port_out(p->port, enableLines | 0x03); port_out(p->port, enableLines | 0x03);
port_out(p->port + 2, ALLEXT ^ OUTMASK); port_out(p->port + 2, ALLEXT ^ OUTMASK);
@@ -268,22 +278,35 @@ unsigned char lcdstat_HD44780_readkeypad(PrivateData *p, unsigned int YData)
{ {
unsigned char readval; unsigned char readval;
// 10 bits output or 6 bits if >=3 displays /* If at most two controllers and NO backlight, 10 bits may be used */
// Convert the positive logic to the negative logic on the LPT port if ((p->numDisplays <= 2) && (!p->have_backlight)) {
port_out(p->port, ~YData & 0x003F); port_out(p->port, ~YData & 0x003F);
if (p->numDisplays<=3) {
// Can't combine >3 displays with >6 keypad output lines
port_out(p->port + 2, (((~YData & 0x03C0) >> 6)) ^ OUTMASK); port_out(p->port + 2, (((~YData & 0x03C0) >> 6)) ^ OUTMASK);
} }
else {
/*
* Else ignore D5, because it may be either backlight or EN3.
* Note: If three displays are used, have_backlight must be
* set to 'no' in the config.
*/
port_out(p->port, (~YData & 0x001F) | p->backlight_bit);
/*
* With at most three controllers or backlight 9 bits may be
* used.
*/
if (p->numDisplays<=3) {
port_out(p->port + 2, (((~YData & 0x01E0) >> 5)) ^ OUTMASK);
}
}
if (p->delayBus) p->hd44780_functions->uPause(p, 1); if (p->delayBus) p->hd44780_functions->uPause(p, 1);
// Read inputs /* Read inputs */
readval = ~ port_in(p->port + 1) ^ INMASK; readval = ~ port_in(p->port + 1) ^ INMASK;
// Put port back into idle state for backlight /* Put port back into idle state for backlight */
port_out(p->port, p->backlight_bit); port_out(p->port, p->backlight_bit);
// And convert value back (MSB first). /* And convert value back (MSB first) */
return (((readval & FAULT) / FAULT <<4) | /* pin 15 */ return (((readval & FAULT) / FAULT <<4) | /* pin 15 */
((readval & SELIN) / SELIN <<3) | /* pin 13 */ ((readval & SELIN) / SELIN <<3) | /* pin 13 */
((readval & PAPEREND) / PAPEREND <<2) | /* pin 12 */ ((readval & PAPEREND) / PAPEREND <<2) | /* pin 12 */
+21 -21
View File
@@ -27,21 +27,21 @@
* Keypad connection (optional): * Keypad connection (optional):
* Some diodes and resistors are needed, see further documentation. * Some diodes and resistors are needed, see further documentation.
* printer port keypad * printer port keypad
* D0 (2) Y0 * D0 (2) Y1
* D1 (3) Y1 * D1 (3) Y2
* D2 (4) Y2 * D2 (4) Y3
* D3 (5) Y3 * D3 (5) Y4
* D4 (6) Y4 * D4 (6) Y5
* D5 (7) Y5 * D5 (7) Y6
* D6 (8) Y6 * D6 (8) Y7
* D7 (9) Y7 * D7 (9) Y8
* nSTRB (1) Y8 * nSTRB (1) Y9
* nSEL (17) Y9 * nSEL (17) Y10 (optional, only if no backlight is used)
* nACK (10) X0 * nACK (10) X1
* BUSY (11) X1 * BUSY (11) X2
* PAPEREND (12) X2 * PAPEREND (12) X3
* SELIN (13) X3 * SELIN (13) X4
* nFAULT (15) X4 * nFAULT (15) X5
* *
* Created modular driver Dec 1999, Benjamin Tse <blt@Comports.com> * Created modular driver Dec 1999, Benjamin Tse <blt@Comports.com>
* *
@@ -179,7 +179,7 @@ void lcdtime_HD44780_backlight(PrivateData *p, unsigned char state)
/** /**
* Read keypress. * Read keypress.
* \param p Pointer to driver's private data structure. * \param p Pointer to driver's private data structure.
* \param YData ??? * \param YData Bitmap of rows / lines to enable.
* \return Bitmap of the pressed keys. * \return Bitmap of the pressed keys.
*/ */
unsigned char lcdtime_HD44780_readkeypad(PrivateData *p, unsigned int YData) unsigned char lcdtime_HD44780_readkeypad(PrivateData *p, unsigned int YData)
@@ -188,19 +188,19 @@ unsigned char lcdtime_HD44780_readkeypad(PrivateData *p, unsigned int YData)
sem_wait(semid); sem_wait(semid);
// 10 bits output or 8 bits if >=2 displays
// Convert the positive logic to the negative logic on the LPT port // Convert the positive logic to the negative logic on the LPT port
port_out(p->port, ~YData & 0x00FF); port_out(p->port, ~YData & 0x00FF);
if (p->numDisplays<=2) { // 9 bits output if backlight is used, 10 bits otherwise
// Can't combine >3 displays with >8 keypad output lines if (p->have_backlight)
port_out(p->port + 2, (((~YData & 0x0100) >> 8) | p->backlight_bit) ^ OUTMASK);
else
port_out(p->port + 2, (((~YData & 0x0100) >> 8) | ((~YData & 0x0200) >> 6)) ^ OUTMASK); port_out(p->port + 2, (((~YData & 0x0100) >> 8) | ((~YData & 0x0200) >> 6)) ^ OUTMASK);
}
if (p->delayBus) p->hd44780_functions->uPause(p, 1); if (p->delayBus) p->hd44780_functions->uPause(p, 1);
// Read inputs // Read inputs
readval = ~ port_in(p->port + 1) ^ INMASK; readval = ~ port_in(p->port + 1) ^ INMASK;
// Put port back into idle state for backlight // Put port back into idle state
port_out(p->port, p->backlight_bit ^ OUTMASK); port_out(p->port, p->backlight_bit ^ OUTMASK);
sem_signal(semid); sem_signal(semid);
+12 -12
View File
@@ -31,19 +31,19 @@
* Keypad connection (optional): * Keypad connection (optional):
* This is connected on the 4094 parallel to the LCD. * This is connected on the 4094 parallel to the LCD.
* Some diodes and resistors are needed, see further documentation. * Some diodes and resistors are needed, see further documentation.
* Q1 (4) Y0 * Q1 (4) Y1
* Q2 (5) Y1 * Q2 (5) Y2
* Q3 (6) Y2 * Q3 (6) Y3
* Q4 (7) Y3 * Q4 (7) Y4
* Q5 (14) Y4 * Q5 (14) Y5
* Q6 (13) Y5 * Q6 (13) Y6
* Q7 (12) Y6 * Q7 (12) Y7
* The 'output' of the keys should be connected to the following LPT pins: * The 'output' of the keys should be connected to the following LPT pins:
* nACK (10) X0 * nACK (10) X1
* BUSY (11) X1 * BUSY (11) X2
* PAPEREND (12) X2 * PAPEREND (12) X3
* SELIN (13) X3 * SELIN (13) X4
* nFAULT (15) X4 * nFAULT (15) X5
* If you want to use as few LPT lines as possible, only use X0. * If you want to use as few LPT lines as possible, only use X0.
* *
* This file is released under the GNU General Public License. Refer to the * This file is released under the GNU General Public License. Refer to the
+13 -13
View File
@@ -46,19 +46,19 @@
* Keypad connection (optional): * Keypad connection (optional):
* Some diodes and resistors are needed, see further documentation. * Some diodes and resistors are needed, see further documentation.
* printer port keypad * printer port keypad
* D0 (2) Y0 * D0 (2) Y1
* D1 (3) Y1 * D1 (3) Y2
* D2 (4) Y2 * D2 (4) Y3
* D3 (5) Y3 * D3 (5) Y4
* D4 (6) Y4 * D4 (6) Y5
* D5 (7) Y5 * D5 (7) Y6
* D6 (8) Y6 * D6 (8) Y7
* D7 (9) Y7 * D7 (9) Y8
* nACK (10) X0 * nACK (10) X1
* BUSY (11) X1 * BUSY (11) X2
* PAPEREND (12) X2 * PAPEREND (12) X3
* SELIN (13) X3 * SELIN (13) X4
* nFAULT (15) X4 * nFAULT (15) X5
*/ */
#include "hd44780-winamp.h" #include "hd44780-winamp.h"