ST7565 LCD DISPLAY

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

ST7565 LCD DISPLAY

Post by cobra1 »

Hi, im playing with the ST7565 custom file, Problem is i cant seem to get it to do anything.

Just a blank screen, do you by any chance have the schematic you used when testing this file??

I have tried the c86 pin high and low and also the P/S pin high and low, but nothing.

I have set the custom file up for the correct data and control pinouts etc, and i belive that my voltage capacators are also correct, as per displaytechs instructions.

Can you be of any help??

ps, display tech say it could be timing issues, my lcd is the S64128M - RGB, could someone compare the timing in the custom file to the timing in the datasheet, im not sure where to look for this in the custom file.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ST7565 LCD DISPLAY

Post by Benj »

Hello,

What speed are you running your chip at? The code will have been tested with a 19.6608MHz crystal in all likelihood.

The function that controls the speed is LCD_Enable, Try adding a few more nop instructions to slow down the speed the Enable line can be pulsed.

Also make sure your chip configuration has things like LVP disabled or this could mean all your I/O is not working as you think.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

Hi Benj,

Im using a 19.6608Mhz crystal, i have also verified that the code is running with a blinking led.

I have LVP disabled and have checked I/O using leds on my lines, all seems in order.

I will try the nop instructions, is there anything else here that might come into play?

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

A quick update,

I have now got the LCD to initialise, i am using the speed test file.
There was a line missing to switch the lcd on,


I can see the X on the LCD corner to corner, but the lines look like \\\\\ they are not connected and are not in the right place, but i can see it flashing on and off as the code tells it to.
When printing strings or numbers i just get lines, but again there in the right sort of area and i can sort of make out how many digits etc.

I have been trying to figure out if the X,Y axis are correct, if i plot on the X axis i get the pixels where they should be, if i plot on the Y axis they are not where there supposed to be, i guess this is why my speed test file isnt displaying correctly

Which area of the code in the .c file is responsible for addressing like this.??
Can you see this being my problem??
Last edited by cobra1 on Thu Apr 07, 2011 9:31 am, edited 1 time in total.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

Hi, i have just noticed that my chipset it a "ST7565R-G"

will this cause a problem or should it work ok, i cant find a datasheet with the G extension

Dont suppose you know what lcd you used when testing this code??

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

Iv just been going through the forum looking for some inspiration when i came across this

http://www.matrixmultimedia.com/mmforum ... =29&t=8035

this is pretty much whats happening to me, was this ever figured out??

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

ok, more problems,

when drawing a box to fill the screen my coordinates are 0,0,127,63 (this works as it should)
when putting a 1 pixel border around the box i use 1,1,125,61 (the 1,1 is correct, but the 125,61 should be 126,62) so its 1 pixel out
when putting a 2 pixel border around the box i use 2,2,123,59 (again the 2,2 is correct but the 123,59 should be 125,61) so its 2 pixels out

this happens for any number, so if i have my start point as 5,5, then the actual 127,63 becomes (127-5 = 122) and (63-5 = 58) so to create a 5 pixel border i need to move in another 5 which now makes the whole thing 5,5,117,53

I hope this makes sense

i think if i can sort this addressing problem then it will work as it should,
Last edited by cobra1 on Thu Apr 07, 2011 1:01 pm, edited 1 time in total.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ST7565 LCD DISPLAY

Post by Benj »

Hello,

The section of code that controls this is the MX_GotoXY function.

You could try changing this section.

Code: Select all

	MX_Write_Command(0x40);						//set display start line
	MX_Write_Command(page);						//set page address
	MX_Write_Command(columnh);					//set column address
	MX_Write_Command(columnl);
to this

Code: Select all

	MX_Write_Command(0x40);						//set display start line
	MX_Write_Command(mx_page);						//set page address
	MX_Write_Command(columnh);					//set column address
	MX_Write_Command(columnl);

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

hi ben

When making this change instead of the box i get 3 lines at the top and loads of scattered pixels

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ST7565 LCD DISPLAY

Post by Benj »

Ok I see,

Thats not the fix then,

I'll see if I can find some time to have a bit of a better look into it for you. Have had a dig through to find out where my test LCD came from but at the moment I have a pile of different displays with no markings. Ill see if I can route out which one uses the ST7565 controller.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

Ok no problem,

If it helps the st7565 is a COG controller so the lcd will have a little chip under it surrounded in silicone

Is there anywhere else in the code i can look to solve this problem?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ST7565 LCD DISPLAY

Post by Benj »

Here is a link to the G version of the datasheet.

http://www.displaytech-us.com/pdf/appli ... 960601.pdf

Column and row addressing are detailed on pages 41 and 42.

Looks to me like they have made things slightly different in the G version so the write of command 0x40 is no longer needed or combined with the page address.

Let me know if you get anywhere and I will look more into it if you are still struggling.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

OK,

I have gone through pages 41-42, and checked it against the code.

Code: Select all

void MX_GotoXY(char x, char y)
{
	char page, columnl, columnh;

	page = (y / 8) | 0xB0; ****correct****
	columnh = (x >> 4) | 0x10; ****correct****
	columnl = x & 0x0F;  ****In the datasheet this says it should be 0x00, when i put that in i get allsorts of junk on screen****

	if(x > 127) x = 0;							//Ensure that coordinates are legal
	if(y > 63)  y = 0;

	mx_currentx = x;
	mx_currenty = y;
	mx_page = y / 8;

	MX_Write_Command(0x40); ****this doesnt make a difference if removed****		//set display start line
	MX_Write_Command(page);					//set page address
	MX_Write_Command(columnh);					//set column address
	MX_Write_Command(columnl);
}



void MX_WriteData(char data)
I cant see much else wrong, is this the only part of the code that controls addressing?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ST7565 LCD DISPLAY

Post by Benj »

Hello,

It could perhaps be something in the draw_rect macro that is causing the issues.

What if you simply call the PlotPixel macro or the draw_line macro? this is basically just calling the GotoXY macro so you should hopefully be able to confirm where the problem is.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

hi,

It doesnt matter what i do to it, it doesnt display correctly

plotting a pixel only works on the top line, after that the pixel location is wrong,

when printing a number ot a string, i just get a line,

The box was the closest i had to doing something it should

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

Ben, Iv sent you a PM

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: ST7565 LCD DISPLAY

Post by Benj »

Hello,

I noticed in the code you sent that the command to mod the Y value was after the gotoXY function.

So you could try changing the Plot Pixel function to look like this.

Code: Select all

	char data, mod_y;
	MX_GotoXY(x, y);
	mod_y = y%8;
	data = MX_ReadData();							//Read 8 pixels from display
	if (colour)
		data = data | (0x01 << mod_y);				//Set Pixel
	else
		data = data & (~(0x01 << mod_y));			//Clear Pixel
	MX_WriteData(data);
If this doesn't work then it may be worth asking for their version of the gotoXY function.

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

hi

I tried that little change and its still the same as before.

whats the rest of that code about where he writes to the ram etc

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times

Re: ST7565 LCD DISPLAY

Post by cobra1 »

I have tried modifying the code i was sent to go with the custom.c file.

I managed to get the code to compile and downloaded to the pic, the line was showing up but it was 8 pixels thick and still had gaps and random pixels around it.

Post Reply