Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Unicorn GLCD demo.

Status
Not open for further replies.
Hi,

I made the change so that I can write in black on a white background, it works very well with the function "PutMessage", but why can't i view my logo when i do "PutLogo", whereas before making the change I got to do what I wanted. I wish that my logo is black on a white background..

I think it would be nice to add some features like draw a circle, or add another size of font.
I would also perform a function that clears a defined area, a function like: ClearScreenZone (x1, y1, x2, y2).
Thank you in advance
 
I watched the "PutLogo" and it involves the "plot", so I presume it must change (reverse) data as you do in the function "putchar", but it does not work correctly. ..
I inpression that the data are inverted, but they are not sent correctly.
Here is the update:

Code:
void plot(unsigned char x,unsigned char y){
unsigned char d;
	if(x>63){
		b_GLCD_GCS1=1;
		b_GLCD_GCS2=0;
		x-=64;
	}
	else
	{
		b_GLCD_GCS1=0;
		b_GLCD_GCS2=1;
	}
	GLCD_Write_Cmd(0x40+x);			//write column address
	GLCD_Write_Cmd(0xb8+(y>>3));	//write row address
	d=GLCD_Read_Data();				//dummy read
	d=GLCD_Read_Data();
	d=~d;                                            /////ADD
	GLCD_Write_Cmd(0x40+x);			//write column address again
	d=d&(0xff-(1<<(y&7)));
	GLCD_Write_Data(d);
}
Can you help me please..
Thanks in advance
 
i just started on the GLCD clock again. I thought since i had gained so much knowledge ill finish my first clock then continue. The pics below are all the clocks i have made and the last would be GLCD one but im still developing the menu for setting the time/date/alarm.

The first one is the best TIME shower. I can see the time across the room at night when im sleepy and it doesn't disturb the eyes. The middle is my desk clock for now until the glcd is done.
 

Attachments

  • rev1.jpg
    rev1.jpg
    67.7 KB · Views: 396
  • rev2.jpg
    rev2.jpg
    105.9 KB · Views: 387
  • rev3.jpg
    rev3.jpg
    107.5 KB · Views: 433
I am using almost the same code and it functions properly for me. My plot function has this line different:

Yours
Code:
        d=d&(0xff-(1<<(y&7)));

Mine
Code:
        if(color)d=d|(1<<(y&7));
	else d=d&(0xff-(1<<(y&7)));

Also, here is a function to draw a circle:
Code:
void bhsmcircle(int xc,int yc,int r)
{
	int x=0,y=r,dp;
	dp=1-r;
	for(;x<y;x++)
	{
		if(dp<0)
		{
			dp+=2*x+3;
		}
		else
		{
			dp+=2*(x-y)+5;
			y--;
		}
		plot(x+xc,y+yc,1);
		plot(-x+xc,-y+yc,1);
	        plot(x+xc,-y+yc,1);
		plot(-x+xc,y+yc,1);
		plot(y+xc,x+yc,1);
		plot(-y+xc,-x+yc,1);
		plot(-y+xc,x+yc,1);
		plot(y+xc,-x+yc,1);
	}
}

EDIT: Be aware that the circle will look more like an ellipse due the rectangular shape of the pixels on the GLCD.
 
Last edited:
Hi,

Thank you for your help.
But according to your function "bhsmcircle",you call the function "plot", but there is 3 arguments: "plot(x+xc,y+yc,1)", the "1" corresponds to the variable "color"?

Should we add the argument "color" has all the functions?
Thank you again
 
I want to do a function for Clear a zone of the glcd as :
ClearScreenZone (x1, y1, x2, y2)
But I can not ...
Can you help me if you like ...
Thank you in advance
 
Try,
Code:
void ClearScreenZone(char x1,char y1,char x2,char y2){
char i,j;
    for(i=y1;i<y2;i++){
        for(j=x1;j<x2;j++)
            unplot(i,j);
    }
}

Mike.
 
Thank you,

But i don't have function "unplot"...
I think to do :
Code:
void ClearScreenZone(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2){
unsigned char m,n;
		for(m=y1;m<y2;m++)
			{
			for(n=x1;n<x2;n++)
				{
				if(n>63){
					b_GLCD_GCS1=1;
					b_GLCD_GCS2=0;
					n-=64;
					}
				else
					{
					b_GLCD_GCS1=0;
					b_GLCD_GCS2=1;
					}
				GLCD_Write_Cmd(0x40+n);			//write column address
				GLCD_Write_Cmd(0xb8+(m>>3));	//write row address
				GLCD_Write_Data(0x00);
				}

			}
}

But it is not yet available
 
It's good ... I succeeded, I created a "unplot" identical to "plot" and I replaced:
Code:
     d=d|(1<<(y&7));
by:
Code:
d=d&(0xff-(1<<(y&7)));

Thanks a lot...
 
Sorry, I forget that my plot function has a color argument added. Well, all my functions that draw something have a color argument added. That is why my plot function is different than yours.
 
Hi SuperBrew,

can you send me your file glcd.c because I too would like the opportunity to choose the color.
And i have another question, how do you display a variable of type float or int, for do a voltmeter, for example.
Thank you in advance
 
Last edited:
Hi,


I have a problem when I want to write a message, I have a string of characters that is nothing ... and that since I added my functions "unplot", "circle" and "fillzone" ...
I post therefore my glcd.c file, could you help me ..

PS: "superbrew", can you send me your your glcd.c which also functions as setting the color of writing?

Thanks in advance
 

Attachments

  • GLCD.c
    9.4 KB · Views: 478
Sorry this took so long. It is a work in progress, so it may be a little messy.
 

Attachments

  • GLCD.c
    12.3 KB · Views: 504
clear all screen

Hi, I tried the function ClearScreenZone with the function unplot(), but only erase the middle of the screen and I need erase all the screen. Can you help me please...thanks
 
Hi,

I have a display problem but not always present.At the launch of my program, the display is correct, and from a time, the display starts to be weird, cutting off the display ( see picture), point cloud ..

Have you any idea?

Thank you in advance
 

Attachments

  • 100_3979.jpg
    100_3979.jpg
    100.8 KB · Views: 343
Last edited:
I don't know the technical explanation for that, but it can happen if you try to write a pixel at a location greater than y = 64 or x = 128. Hope that helps.
 
You're right, it then yest sometimes greater than 64 and x greater than 128.
But how can I solve my problem? Is there a solution?
Thank you in advance
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top