CFAG320240CX-TFH-T-TS keeps turning off

Spfxtech

New member
What would cause the LCD to just turn off (except for a single line across the screen)? I've interfaced this LCD with a PIC24F and, after I got the timing down, displaying text and graphics have been no problem. Now though, after attempting to add the touchscreen functionality, the LED is shutting down for no particular reason. I don't believe it has anything to do with the PIC as the LCD would actually go blank when I just hooked up 3.3VDC across the Left-Right portion of the touchscreen without any other connection to the microcontroller. Now I've got it setup that as I sense off of the bottom of the touch screen, I get the screen to switch between two screens, depending on which side of the screen I touch. The LCD still goes out and it isn't predictable (whether I switch quickly or slowly between the screens it still blanks out seemingly randomly). I've tried pull-ups on the reset and display off lines, pull-downs on the enable line, a 470uF cap across the 5VDC in. I've even added more delay time in my code between writes and so far nothing has helped. If you have ANY ideas I'd appreciate them...I actually have to present this Wednesday night and I can't afford to have it blanking out on me.

Here's my main LCD functions (minus my graphics functions)
Code:
void ConfigureLCD(){
	ResetLCD();
	Delay_config(1);
	LCDCommandWrite(0x0400); // SYSTEM SET
	LCDDataWrite(0x0300); 
	LCDDataWrite(0x0870);
	LCDDataWrite(0x0070);
	LCDDataWrite(0x0270);
	LCDDataWrite(0x0420);
	LCDDataWrite(0x0EF0);
	LCDDataWrite(0x0280);
	LCDDataWrite(0x0000);
	LCDCommandWrite(0x0600); // GRAYSCALE
	LCDDataWrite(0x0000); // originally 0x0010 (2 bits per pixel)
	LCDCommandWrite(0x0440); // SCROLL
	LCDDataWrite(0x0000);
	LCDDataWrite(0x0000);
	LCDDataWrite(0x0EF0);
	LCDDataWrite(0x0600);
	LCDDataWrite(0x0090);
	LCDDataWrite(0x0EF0);
	LCDDataWrite(0x0000);
	LCDDataWrite(0x0000);
	LCDDataWrite(0x0000);
	LCDDataWrite(0x0000);
	LCDCommandWrite(0x05A0); // HDOT SCR
	LCDDataWrite(0x0000); // No horizontal scrolling
	LCDCommandWrite(0x05B0); // OVLY
	LCDDataWrite(0x0010);
	LCDCommandWrite(0x05D0); // CRSFORM
	LCDDataWrite(0x0070);
	LCDDataWrite(0x0870);
	LCDCommandWrite(0x04C0); // CRSDIR
	ChangeLCDScreen(0); // Load 'Home' Screen
	LCDCommandWrite(0x0590); // Turn Display On
	LCDDataWrite(0x0140); // Layer 1 & 2 On w/o flashing, cursor off
	Delay_config(0);
}

void ClearLCDL2(void){
	int i;
	LCDCommandWrite(0x0460);  // Position cursor
	LCDDataWrite(0x0600);
	LCDDataWrite(0x0090);
	LCDCommandWrite(0x0420);
	for(i=0; i < ((0x28) * 240); i++) // 240 * APL
		{
		LCDDataWrite(0x0000);
		}
}

void ClearLCDTextLayer(void){
	int i;
	unsigned char c;
	c = 'A';
	LCDCommandWrite(0x0460);  // Position cursor
	LCDDataWrite(0x00);
	LCDDataWrite(0x00);
	LCDCommandWrite(0x0420);
	for(i=0; i < ((0x28) * 30); i++)  // 30 * APL
		{
		LCDDataWrite(0x0200);
		}

}

void ResetLCD(void){
	Delay_config(0);
	_RC8 = 0; // activate LCD reset
	Delay_ms(1);
	_RC8 = 1; // deactivate LCD reset
	Delay_ms(3);
}

void LCDCommandWrite(unsigned int intDataByte){
	LATB |= ((intDataByte & ~(0x0FE0)) * 256) + intDataByte; // Set DB[7:0]
	LATC &= ~(0x0080); // clear !CS
	LATC |= 0x0050; // !CS = 0, A0 = 1, R/!W = 0, E = 1
 	Nop8(); // 500ns delay
	LATC ^= 0x0090; // !CS = 1, A0 = X, R/!W = 0, E = 0
	LATB &= ~(0x1FE0); // clear LATB
}

void LCDDataWrite(unsigned int intDataByte){
	//LATB |= intDataByte; // Set DB[7:0]
	LATB |= ((intDataByte & ~(0x0FE0)) * 256) + intDataByte; // Set DB[7:0]	
	LATC &= ~(0x00c0); // clear !CS
	LATC |= 0x0010; // !CS = 0, A0 = 0, R/!W = 0, E = 1
 	Nop8(); // 500ns delay
	LATC ^= 0x0090; // !CS = 1, A0 = X, R/!W = 0, E = 0
	//LATB &= ~(0x0FF0); // Clear LATB register
	LATB &= ~(0x1FE0); // clear LATB
}
void LCDPositionCursor(unsigned int intHighAddress, unsigned int intLowAddress){
	LCDCommandWrite(0x0460);
	LCDDataWrite(intLowAddress);
	LCDDataWrite(intHighAddress);
}
**NOTE: I had to do a little bit of wierd shifting for LATB (I had to change one of the data pins mid project and that was the only way I saw of doing it)**
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

CF Tech

Administrator
This has to be some kind of a noise problem.

How is your setup created (PCB, cable, breadboard, etc)?

If you have a long cable or a breadboard, try adding a smaller say 0.1uF or 1.0uF (which will respond to higher frequency glitches better) cap in parallel with the big 470uF. If the wires are loose, try twisting the power and ground, which will minimize the loop area.

What is the reset line connected to?
 

Spfxtech

New member
Still having the same problem

To Henri: Currently ungrounded? I don't have the LCD in an enclosure yet. I assumed they would be attached to the frame ground, and the problem occurs whether or not I have the frame ground connected.

To CF Tech: I tried the 1uF cap in parallel, but same problem. The reset is connected directly to a digital output @ 3.3V and I hooked a pullup 10kohm resistor to it and a 10kohm pulldown resistor on the enable line. My DISPOFF is floating, but I've tried having it connected and I still get the same problem.

Below is a link to my webspace. I've uploaded a low-res video that shows the basic board setup and shows the problem happening. I also have a couple of clearer pictures showing the Breadboard setup, and two screenshots.
http://home.earthlink.net/~spfxtech







BTW, whether or not you guys manage to help me or not, I REALLY APPRECIATE that you are trying to and on the weekend no less...THANK YOU!

James Washington
 

Attachments

CF Tech

Administrator
The capacitance needs to be soldered right at the pins of the LCD. The type of low impedance we are looking for the capacitor to provide will be completely hidden by the wires and breadboard connections.

Breadboards are great for quick prototyping, but they are notorious for poor connection reliability. It could be that there is some slight physical wiggle that happens when you touch the screen, and that wiggle is breaking a connection for a tiny amount of time--causing the reset.

You may want to look into PCB software (Eagle has a free version), and you can get PCBs made very reasonably now. Accutrace has a 10 piece for $10 each with $10 shipping, for a double-sided PCB with solder mask on both sides and silkscreen on the top. Pretty hard to beat $110 for "real" PCBS :)

To CF Tech:. . .on the weekend . . .
Uggh. I'm just trying to avoid working on the other project I'm supposed to be doing.

Your project looks like fun, and it looks like you are doing a nice job on the user interface.
 

Spfxtech

New member
Tried soldering caps to pins

Still have same problem, but I have found an action that will always cause screen to go blank. If, while it is on, I disconnect my sensing line (the line between the bottom touchscreen pin and my A/D convertor pin) my screen immediately blanks out (except for the line). I'm going to double check my code and my I/O configuration. If you can think of any reason "LCD side" why unplugging the line would cause this "crash" let me know, otherwise, I'm going to shift my sleuth work towards the microcontroller. I, also, just disconnected the touch screen from the microcontroller completely and my screen shut down and stayed down...I'm definately switching suspects.

James Washington
 

Spfxtech

New member
Woah...still seriously confused

Okay...I've temporarily edited my code to NOT sample the A/D pin I was using for the touch screen and I've disconnected the wire to it. So now, what my program does is load my "home" screen and then go into a happy little 'while(1);' loop that doesn't do anything. As soon as I connect the left side of my touchscreen to 0VDC and the right side to 3.3VDC, the screen blanks out and I can't get the screen to come back on unless I disconnect the wire to the +3.3VDC side from the touchscreen. WTF???? I checked my current draws and without the touchscreen connected, I'm drawing about 20 mA; when I added the touchscreen I only drew 4mA more! My power supply limits current to about 150mA, and I didn't see any voltage drop when I connected the touch screen so any ideas?

James Washington :confused:
 

Spfxtech

New member
One more discovery (maybe useful...maybe not)

My microcontroller runs on 3.3VDC, while the LCD runs on 5VDC. My microcontroller Abs max voltage is 4VDC. If I adjust my power supply to 3.3VDC the LCD runs fine until I hook up the touchscreen to the 3.3VDC "bus," (and I have also tried the 5VDC "bus" both with a common ground) at which point I get the "blank screen of death." If, however, I push my microcontroller near its limits at 3.9VDC, hooking up the touchscreen may cause an initial reset, but then the screen will come back on.

Does this "jog" any ideas?

James Washington :confused:
 

CF Tech

Administrator
To my knowledge, there should not be a connection at all between the touch screen and the LCD.

In this case, is sounds like one of the touch screen conductors might be connected to either ground of Vdd of the LCD.

Please use an ohm meter to see if any of the touch screen conductors has a low resistance path to either ground or Vdd.

Please let me know what you find.
 

Spfxtech

New member
No shorts...

I checked between Vdd and each individual pin of the touch screen, and did likewise for Vss, but all was as it should be. It's so sad, I'm changing my program today to implement a button interface since I can't get the touchscreen to work.

James Washington :(
 

Henri

New member
Curious, I connected a CFAG320240CX-TFH-T-TS today and I'm having similar issues with the touch screen. For me the display doesn't start up at all if I have the touch screen cable connected. And as soon as I connect the cable the display blanks with that one line on it. I assume the S1D13700 halts it's outputs.
I haven't touched my code at all yet as I had it working earlier with another LCD with S1D13700 and touch screen. Touch screen controller part also is the same that was working before, based on the ADS7843. I can read touch screen positions without problems after the screen blanks though.

Wondering if there could be some kind capacitance issue with the large touch screen plate on top of the display module.

So guess I'll begin troubleshooting this tomorrow or sometime soon and let you know what I find out.
 

Spfxtech

New member
Thanks...I'm still curious!

To Henri: Thanks for checking into it and please let me know! Even though I have to move forward, for now, as if I don't have a touchscreen, I REALLY would like to know what is going on for future use and for the sake of knowledge!

James Washington :eek:
 

CF Tech

Administrator
. . .Wondering if there could be some kind capacitance issue with the large touch screen plate on top of the display module. . . .
Hmmmm. I wonder if a series resistor to the touch screen connections would help then. That resistor would form an RC and slow down the transition, which would reduce any signal coupled into the controller.

The resistor would change the ADC readings, but that should fall out in the calibration routine.
 
Top