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.