Specifically, I'm using a CFAG320240CX-TFH-T.
I had some problems, and spent a lot of time, getting this guy going. I looked at sample code that Crystalfontz sent me and the code from PlazmaFox. Thanks!
The main reason for my problems was that I was using a 3.3v microcontroller (LPC2138) at first. It didn't work with two different displays. I believe it was due to the 3.3v signal levels. I tried running the LCD at 3.3 volts with no luck. I switched to the PIC18F4520 at 5v and it was all good.
Anyway, to help others who might want to see yet another example I'm including Example.zip and a PDF of the schematic.
Note that I am using 12v to drive the backlight so that my 5v regulator doesn't have to work as hard (and get as hot). If you use 9v or 5v you'll need different resistors. I'm using two 100 ohm, 1 watt resistors in parallel to get 50 ohms and the correct wattage. The backlight is controlled by a PWM signal from the PIC driving a logic level MOSFET. The backlight can be set to one of 10 different levels using push buttons. The backlight setting is stored in the EEPROM and recalled after a reset.
Remember that this code is an excerpt. You may have to make some changes to the main code to get it to compile and run. The driver files (glcd.c, glcd.h) are just the way I use them.
I had some problems, and spent a lot of time, getting this guy going. I looked at sample code that Crystalfontz sent me and the code from PlazmaFox. Thanks!
The main reason for my problems was that I was using a 3.3v microcontroller (LPC2138) at first. It didn't work with two different displays. I believe it was due to the 3.3v signal levels. I tried running the LCD at 3.3 volts with no luck. I switched to the PIC18F4520 at 5v and it was all good.
Anyway, to help others who might want to see yet another example I'm including Example.zip and a PDF of the schematic.
Note that I am using 12v to drive the backlight so that my 5v regulator doesn't have to work as hard (and get as hot). If you use 9v or 5v you'll need different resistors. I'm using two 100 ohm, 1 watt resistors in parallel to get 50 ohms and the correct wattage. The backlight is controlled by a PWM signal from the PIC driving a logic level MOSFET. The backlight can be set to one of 10 different levels using push buttons. The backlight setting is stored in the EEPROM and recalled after a reset.
Remember that this code is an excerpt. You may have to make some changes to the main code to get it to compile and run. The driver files (glcd.c, glcd.h) are just the way I use them.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
Attachments
-
108.7 KB Views: 2,794
-
5.2 KB Views: 1,871
Last edited: