Professional Documents
Culture Documents
Brian Wendling
March 26,2007
Executive Summary
This paper will demonstrate the two most common ways to use a
Crystalfontz LCD display with a Microchip PIC18F4520. Both ways are
relatively easy to implement, differing only in the hardware required to
program the LCD. The first design uses the serial communication
capabilities of the PIC to communicate to the computer via the computers
serial communication port using some additional circuitry. The second
design configures the LCD to work specifically with the PIC by changing its
logic and power requirements. Each design uses the same library of
functions provided by Crystalfontz, which, makes it easy to write
customized programs for the LCD via the PIC18F4520. This application
note assumes that the reader has is familiar with the PIC18F450 and knows
how to use the MPLAB software, which, is used to program the PIC.
1
Introduction
The Crystalfontz 634 LCD display is a four-line display with a backlight and
serial communication port. The serial communication port makes the
Crystalfontz 634 a very popular display for it is easy to integrate with a
personal computer. Many hobbyists use the Crystalfontz 634 to display vital
functions on their computer such as over clocking, temperature and system
resources. However, there is another way that allows the user to connect the
LCD directly to a PIC via solder connections. Both procedures will be
discussed within this paper allowing the user to implement either of theses
designs for their particular use.
2
Basic Connections to PIC and R11 Header
Below are the connections that must be made to the PIC and R11 header.
These connections are identical for both designs.
PIC18f4520 Connections
Pin 11 and pin 32 connected to VDD (+5V).
10K resistor connecting pin 1 and VDD (+5V).
Pin 12 and pin 31 connected to GND.
Pin 12 Pin 31
Pin 13
External
Clock
.
Figure 3: External Clock Diagram and Connections
3
R11 Headers Connections
The Winford R11 header is used to program the PIC via the USB connected
programming device and the MICROCHIP MPLAB software.
4
Figure 6: Crystalfontz 634 DB-9 (Port J1) Pin Out
When using the J1 ports to communicate with the LCD you must also
connect two pins on the J2 connection to power the display. Pin 1
(GROUND) must be connected to ground and pin 3 (+5V LED) must be
connected to a 5V power supply.
Necessary Hardware
MAX232 chip
Winford BC9F header
4- 10µF capictors
RS-232 Cable
Setup
The MAX232 chip must be connected to the PIC to allow
communication through the serial port. Pin 25 of the PIC must be
connected to pin 11 of the MAX232. Pin 26 of the PIC must be
connected to pin 12 of the MAX232. These connections are shown in the
figure below, along with the necessary connections to power and ground.
5
Figure 8: Connections to the MAXIM MAX 232 Chip
(COM1 DB9 in the Winford BC9F header)
Setup
To communicate directly with the LCD via the PIC some solder
connections must be closed on the back of the LCD itself. These
connections will invert the RS-232 logic and change to LCD voltage
6
level, so it operates on 0 to 5V.These connections are labeled JPB and
JPE respectively.
Wires must also be attached to the J2 solder connections on the LCD.
Pin 1 must be attached to GROUND. Pins 2 and 3 must be connected to a
+5V power supply. Pin 4 (Data_In) must be connected directly to pin 25
of the PIC, which is the PIC’s TX pin. Again try sending the FormFeed
command to the LCD using the same format as above. If it does not work
check all the solder connections and connections to the PIC itself.
References
7
Appendix 1
#include <usart.h>
#ifndef _CF634LIB_H_
#define _CF634LIB_H_
while(BusyUSART());
while(buffer[i] != '\0')
{
putcUSART(buffer[i]);
i++;
while(BusyUSART());
}
8
}
void lcd_reboot()
{
char out[] = {Reboot, Reboot};
lcd_write(out);
}
lcd_write(out);
}
void lcd_cursor_home()
{
char out[] = {Cursor_Home};
lcd_write(out);
}
if (style == 0)
out[2] = 0xFF;
if (style == 1)
out[2] = 0x55;
9
out[5] = data;*/
lcd_write(out);
}
lcd_write(out);
}
#endif /* _CF634LIB_H_ */
10
11