Difference between revisions of "PIC32MX: Parallel LCD"
NickMarchuk (talk | contribs) |
NickMarchuk (talk | contribs) |
||
Line 1: | Line 1: | ||
Using |
Using 7 pins on the PIC32 it is possible to interface with the popular HD44780 (and compatible chipsets) for easy character output to an LCD. This can be highly useful in either debugging or generating a more complex user interface for a PIC (or other microcontroller)-based device. |
||
First you will need to locate the appropriate datasheet for the actual LCD you are using. What you will want to look up in there is the arrangement of connectors on the top-left of the display, and their names so that you can appropriately match the right connectors with the correct pins on the microcontroller, and in turn with the correct software identifiers for those connections. An example of one such pin arrangement is below. |
First you will need to locate the appropriate datasheet for the actual LCD you are using. What you will want to look up in there is the arrangement of connectors on the top-left of the display, and their names so that you can appropriately match the right connectors with the correct pins on the microcontroller, and in turn with the correct software identifiers for those connections. An example of one such pin arrangement is below. |
||
Line 35: | Line 35: | ||
Next, you'll need to wire up the LCD for power, and the connections with the pic. |
Next, you'll need to wire up the LCD for power, and the connections with the pic. |
||
<table border = 1> |
|||
<tr><td>LCD Pin</td><td>PIC Pin</td></tr> |
|||
<tr><td>1 - VSS</td><td>GND</td></tr> |
|||
<tr><td>2 - VCC</td><td>+5V</td></tr> |
|||
<tr><td>3 - VEE</td><td>1.5kOhm to GND</td></tr> |
|||
<tr><td>4 - RS</td><td>B4</td></tr> |
|||
<tr><td>5 - R/W</td><td>B5</td></tr> |
|||
<tr><td>6 - E</td><td>B6</td></tr> |
|||
<tr><td>7 - DB0</td><td>NC</td></tr> |
|||
<tr><td>8 - DB1</td><td>NC</td></tr> |
|||
<tr><td>9 - DB2</td><td>NC</td></tr> |
|||
<tr><td>10 - DB3</td><td>NC</td></tr> |
|||
<tr><td>11 - DB4</td><td>B0</td></tr> |
|||
<tr><td>12 - DB5</td><td>B1</td></tr> |
|||
<tr><td>13 - DB6</td><td>B2</td></tr> |
|||
<tr><td>14 - DB7</td><td>B3</td></tr> |
|||
<tr><td>15 - LED+</td><td>+3.3V</td></tr> |
|||
<tr><td>16 - LED-</td><td>GND</td></tr> |
|||
</table> |
|||
The VEE pin on the LCD sets the contrast of the characters on the LCD. Play with a voltage around 1V to get a nice contrast, or hook it too GND through a 1.5kOhm resistor, which also seems to work well. |
|||
If you power the LCD but do not send it any commands, the top row should fill with boxes. Use this to check that your LCD works. |
Revision as of 21:45, 3 January 2010
Using 7 pins on the PIC32 it is possible to interface with the popular HD44780 (and compatible chipsets) for easy character output to an LCD. This can be highly useful in either debugging or generating a more complex user interface for a PIC (or other microcontroller)-based device.
First you will need to locate the appropriate datasheet for the actual LCD you are using. What you will want to look up in there is the arrangement of connectors on the top-left of the display, and their names so that you can appropriately match the right connectors with the correct pins on the microcontroller, and in turn with the correct software identifiers for those connections. An example of one such pin arrangement is below.
|
Your controller may differ from this one. Occasionally even if you've got the right datasheet these pin numbers can be backwards. If it has a backlight, try powering that up first and ensure that works.
Next, you'll need to wire up the LCD for power, and the connections with the pic.
LCD Pin | PIC Pin |
1 - VSS | GND |
2 - VCC | +5V |
3 - VEE | 1.5kOhm to GND |
4 - RS | B4 |
5 - R/W | B5 |
6 - E | B6 |
7 - DB0 | NC |
8 - DB1 | NC |
9 - DB2 | NC |
10 - DB3 | NC |
11 - DB4 | B0 |
12 - DB5 | B1 |
13 - DB6 | B2 |
14 - DB7 | B3 |
15 - LED+ | +3.3V |
16 - LED- | GND |
The VEE pin on the LCD sets the contrast of the characters on the LCD. Play with a voltage around 1V to get a nice contrast, or hook it too GND through a 1.5kOhm resistor, which also seems to work well.
If you power the LCD but do not send it any commands, the top row should fill with boxes. Use this to check that your LCD works.