CFAG320240CX-TMI-T Initialization trouble

Contrail12

New member
I am a computer engineering student and recently ordered a CFAG320240CX-TMI-T through my school to use as a screen for an oscilloscope that my group is building. The only problem is that I cannot get the screen to show ANYTHING. I have double and triple checked the wiring, left frame ground floating, have DISPOFF tied high, R/W tied low, and am operating in 6800 mode. I have adjusted the contrast potentiometer untill pin 3 (V0) measured -18.5v. We are using a MC9S12C32 mororola micro controller to controll the Screen and are writing our code in C using code warrior. I have verified that the output signals are working as my code expects using a logic anylizer and I am confident that the screen is not broken as it flashes once every time I issue the system set command, but I cant get anything to show on the screen at all. Below is my implementation of the initialization sequence found on page 103 of the spec sheet... Please Help!!!!
PHP:
#include <hidef.h>      /* common defines and macros */
#include <mc9s12c32.h>     /* derivative information */

#include "main_asm.h" /* interface to the assembly module */

#pragma LINK_INFO DERIVATIVE "mc9s12c32"
#define LCD_RES PTM_PTM4 /* LCD controller resets when this is set to low */
#define LCD_E PTM_PTM0
#define LCD_CS PTM_PTM1
#define LCD_A0 PTM_PTM2 

/* LCD Command Definitions */

void Write_To_LCD_BUS(byte Data);
void Write_LCD_Command(byte Inst);
void Write_LCD_Data(byte Data);


void main(void) {

//Idle the control lines & reset the display
DDRM = 0xFF; /* Set ports to function as outputs */
DDRT = 0xFF; /* Set ports to function as outputs */


LCD_RES = 0;
LCD_E = 0;
LCD_A0 = 0;
LCD_CS = 1;
Write_To_LCD_BUS(0);
LCD_RES = 1;


//system set
Write_LCD_Command(0x40);
Write_LCD_Data(0x38);
Write_LCD_Data(0x87);
Write_LCD_Data(0x07);
Write_LCD_Data(0x3F);
Write_LCD_Data(0x49);
Write_LCD_Data(0x7F);
Write_LCD_Data(0x80);
Write_LCD_Data(0x00);

//Scroll
Write_LCD_Command(0x44);
Write_LCD_Data(0x00);
Write_LCD_Data(0x00);
Write_LCD_Data(0x40);
Write_LCD_Data(0x00);
Write_LCD_Data(0x10);
Write_LCD_Data(0x40);
Write_LCD_Data(0x00);
Write_LCD_Data(0x04);
Write_LCD_Data(0x00);
Write_LCD_Data(0x30);

//HDOT SCR
Write_LCD_Command(0x5A);
Write_LCD_Data(0x00);

//OVLAY
Write_LCD_Command(0x5B);
Write_LCD_Data(0x01);

//Display Off
Write_LCD_Command(0x58);
Write_LCD_Data(0x56);

//CSRW
Write_LCD_Command(0x46);
Write_LCD_Data(0x00);
Write_LCD_Data(0x00);

//CSR FORM
Write_LCD_Command(0x5D);
Write_LCD_Data(0x04);
Write_LCD_Data(0x86);

//Display ON
Write_LCD_Command(0x59);
Write_LCD_Data(0x56);

//CSR DIR
Write_LCD_Command(0x4C);

//Write Data
Write_LCD_Command(0x42);
Write_LCD_Data(0x20);
Write_LCD_Data(0x45);
Write_LCD_Data(0x50);
Write_LCD_Data(0x53);
       

       EnableInterrupts;
       asm_main(); /* call the assembly function */
       for(;;) {} /* wait forever */
}
void Write_To_LCD_BUS(byte Data) {

       PTT = Data;
}
void Write_LCD_Data(byte Data) {

       Write_To_LCD_BUS(Data);
       LCD_A0 = 0; /* Set to write data */
       LCD_CS = 0;
       LCD_E = 1;  /* May need to insert a wait after this to control pulse width */
       LCD_E = 0;  /* Pulse E */
       LCD_CS = 1;
}
void Write_LCD_Command(byte Inst) {

       Write_To_LCD_BUS(Inst);
       LCD_A0 = 1; /* Set to write a command */
       LCD_CS = 0;
       LCD_E = 1; /* May need to insert wait code after this */
       LCD_E = 0; /* Pulse E */
       LCD_CS = 1;
}
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

Contrail12

New member
I know that I will need some delay to widen the E pulse, however I am trying to initialize the LCD by stepping through my code via a microcontroller monitor application, so there is mostlikely at least 2ms between the execution of every line of my program. I will add sode code to widen the E pulse later today, but I just wanted to add this information to the thread now.
 

Contrail12

New member
I have added delay code to make my E pulse longer, and have varied the delay to be several msecs long, but the screen still shows nothing.
 
Its possible that you still don't have enough contrast. Try turning up (or down) Vo to see if all the pixels start to darken (or lighten), and maybe your data will become visible. If still no data visible, then you may have a wiring error (i.e. good signal but wrong input pin).
 

CF Tech

Administrator
Please verify every pin all the way from your code to the connector on the LCD.

Make a loop that sets all lines low, then toggles just LCD_E (something identifiable, like 1ms high, 10ms low), then use the scope to verify that LCD_E and only LCD_E is toggling. Repeat this for every line.

If that test does not pass, it will never work right.

Pin 3 should be at about -19 volts.
 

Contrail12

New member
I did your test and found that data pins 4 and 5 were switched with each other. I had assumed that they were right as my professor said that he had verified then, but later admitted that he stopped at pin 3. Thank you very much for the help, I can now get the screen to turn on, but not print any charachters. But I'm sure that this is because I haven't cleared the graphics layer, so no worries. Thanks again everyone.
 

CF Tech

Administrator
Great, hope that gets it rolling. Please post some pics when you get it up, and we always appreciate code samples posted here in the forum.
 
Top