• We recently switched our forum platform. If you experience any issues please email support@crystalfontz.com

CFAG19264A Basics

mcintjt

New member
Hello - I am new to GLCD programming, and am having trouble getting anything to display on my screen (front view CFAG19264A-STI-TN). I am programming in C on a PSoC. When I connect my circuit to power, the entire screen lights up to the same brightness. I do not know whether to think this all pixels showing or no pixels showing.

On the PSoC I have the 8 data lines to the LCD connected to port 2 so that data[7] corresponds to P2[7], etc.

Also, I have the control pins connected to port 1 of the PSoC as follows:
P1[7] = E
P1[6] = R/W
P1[5] = RS
P1[4] = RST
P1[3] =
P1[2] = CS3
P1[1] = CS2
P1[0] = CS1

Lastly, the remainder of the LCD pins are connected as follows:
Vss = ground
Vdd = 5V
Vo = middle pin of a 100K pot (one side to Vss, other side to Vee)
Vee = as just said, to one side of the pot
A = 2.75V

**update** I have adjusted the voltage on pin A from 5 V to 2.75 V. This looks much better! The screen now looks like the one is the picture, only blank. Initially the screen was very bright. **update**

First, am I overlooking anything in this layout?

Secondly, please look at my C code and help me see if the problem is there. Is this the correct process for outputting some simple data to the screen?

Code:
void main()
{
   GLCD_reset();
   GLCD_Display(1);
    
   GLCD_write_data(0,0x66);
   GLCD_write_data(1,0x66);
}
Code:
void GLCD_reset()
{
	int i;
	PRT1DR = 0x00;                // pull down reset
	for( i = 0; i < 10000; i++ );      // delay
	PRT1DR = 0x17;		//binary = 0001 0111
}

void GLCD_Display( BOOL on )
{
	BYTE x = 0x3E | (on & 1);	//0011 1110
	GLCD_write_ins( 0, x );
	GLCD_write_ins( 1, x );
	GLCD_write_ins( 2, x );
}

void GLCD_write_ins( BYTE drv, BYTE ins )
{
	switch(drv){
		case 0:
			PRT1DR = 0x16;	//0001 0110
			break;
		case 1:
			PRT1DR = 0x15;	//0001 0101
			break;
		case 2:
			PRT1DR = 0x13;	//0001 0011
			break;
		default:
			PRT1DR = 0x16;	//0001 0110 same as case 0
			break;
	}
	PRT0DR = ins;         // write instruction
	PRT0DM0 = 0xFF;    // turn on port 0's output - strong mode
	PRT0DM1 = 0x00;
	PRT1DR |= 0x80;     // turn E on
	PRT1DR &= 0x7F;     // turn E off
}

void GLCD_write_data( BYTE drv, BYTE data )
{
	switch(drv){
		case 0:
			PRT1DR = 0x36;	//0011 0110
			break;
		case 1:
			PRT1DR = 0x35;	//0011 0101
			break;
		case 2:
			PRT1DR = 0x33;	//0011 0011
			break;
		default:
			PRT1DR = 0x36;	//0011 0110  same as case 0
			break;
	}
	PRT0DR = data;      // write data
	PRT0DM0 = 0xFF;   // turn on port 0's output - strong mode
	PRT0DM1 = 0x00;
	PRT1DR |= 0x80;    // turn E on
	PRT1DR &= 0x7F;    // turn E off
}
Thank You!
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
Last edited:

mcintjt

New member
Thank you. Turns out I needed a negative voltage on the v0 pin. The schematic in the datasheet needed a little bit of adjusting.

Also, took quite a bit of pot tweaking to get things to show up. Nevertheless, they do show up now!
 

CF Tech

Administrator
Awesome!

I do not think we have any PSoC sample code for the CFAG12864A series. Do you think you could post your working version?

We always love to see photos too, so please feel free to post a pic or three up :)
 

mcintjt

New member
Well, the good news is that I am able to display things on the screen... the bad news is that I am still trying to figure out how to display what I want to on the screen.

The screen is 192x64, so there are three 64x64 pixel blocks. I have a 64x64 pixel image that I want to display on only one section. However, I am having trouble with it showing up in multiple places (more than the desired third).

Now, I just realized that the LCD may hold the data that was previously in there. Do I need to write 0 everywhere that I want to ensure is blank? I'll check that now...

Once I get things working, I'll be happy to post everything. Hopefully it can help someone else out in the future.
 

mcintjt

New member
Looks like that may be true. Also, the chip select lines for the CFAG19264A are active high, not active low. As a result, my previous code was always selecting two lines, not one.

Updates to follow...
 
Top