Difference between revisions of "PIC32MX: Parallel LCD"

From Mech
Jump to navigationJump to search
Line 1: Line 1:
Using 11 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.
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.

Lcd pins.jpg
PinDescription
1VSS
2VCC
3VEE
4RS
5R/W
6E
7DB0
8DB1
9DB2
10DB3
11DB4
12DB5
13DB6
14DB7
15LED+
16LED-

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 PinPIC Pin
1 - VSSGND
2 - VCC+5V
3 - VEE1.5kOhm to GND
4 - RSB4
5 - R/WB5
6 - EB6
7 - DB0NC
8 - DB1NC
9 - DB2NC
10 - DB3NC
11 - DB4B0
12 - DB5B1
13 - DB6B2
14 - DB7B3
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.