Command sequence for CFAG240128D

Mike2006

New member
Hi,

I’m having trouble interpreting the data sheet for the LC7981 controller that’s onboard my CFGA240128-FMI-T LCD. Reading the written description of how to write to the various registers, I’m not seeing any references to the enable pin. The timing diagram, however, appears to show the enable pin as part of the read and write cycles. Here’s a partial example of what I’m doing to try and get the LCD to simply show “ABCDEF” at the top line of the display:

LCD Connections
1 – gnd
2 – 5V
3 – N/C
4 – uController Output Pin
5 – Tied to gnd
6 to 14 – uController Output Pins
15 – Tied to gnd
16 – Tied to 5V
17 to 20 – N/C

Command Sequence 1 (Mode Control)
Set RS
Set Enable
Put 00000000 on Data Bus
Clear Enable
Clear RS
Set Enable
Put 00110000 on Data Bus
Clear Enable

Command Sequence 2 (Character Pitch)
Set RS
Set Enable
Put 00000001 on Data Bus
Clear Enable
Clear RS
Set Enable
Put 00100101 on Data Bus
Clear Enable


Am I on the right track? All I’m getting at this point is a whole screen of jumbled character fragments.

Also, is it best to set the duty to 1/64 or 1/128? The data sheet specifies duty as 1/128 but also says “please set to 1/64”.

Thanks!
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Mike2006

New member
CF Tech said:
The easiest thing to do is to model your code after the example code:

http://www.crystalfontz.com/backlight/Demo_Code/CFAG240128D_WinTest.zip

From:

https://forum.crystalfontz.com/showthread.php?threadid=3257

Look for "void CCFAG_WinTestDlg::OnInitialize()" in "CFAG_WinTestDlg.cpp" and just port that function and its supporting macros to your system.
Wow... I was finally able to mine enough info out of the "CFAG_WinTestDlg.cpp" file to get the LCD working. Geez, Sanyo sure gave us a lame datasheet.

Thanks for the help...
 

CF Tech

Administrator
Glad you got it working.

What proc are you using? Feel free to post example code if you want to and can.
 

Mike2006

New member
CF Tech said:
Glad you got it working.

What proc are you using? Feel free to post example code if you want to and can.
Sure, I'm using a Microchip PIC18F4331 running at 8Mhz. Attached is a .txt version of the source file (from MPLAB IDE 7.30) I used to test the LCD. It's rather primitive and all it does is display "ABC" in the upper left corner of the LCD. As people who work with microcontrollers for a living can probably tell, this is strictly a hobby for me... Anyway, Port C of the PIC is connected to the LCD data bus and Port D is as follows- bit 0 is RS, bit 1 is Enable, bit 2 is CS, and bit 3 is Reset.

-Mike
 

Attachments

Top