troubles in updating icon in GLCD

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
kahbee
Posts: 1
Joined: Wed Mar 09, 2011 3:27 pm
Contact:

troubles in updating icon in GLCD

Post by kahbee »

hi. i am using T6963C GLCD. i tried to update icon pixel by pixel and delete it pixel by pixel so that the icon can actually moves. however, i faced a problem as the icon is actually is deleted by batches. it troubles me as it deleted the map which i have put previously. can anyone help me to see what is wrong with my code?

Code: Select all

void d_icon(int x,int y)								//display first bit of 8x8 icon at x,y position 
{
	char i,j;

	if (p_x%16 <8)										//if x position is on upper byte of 16 bit
	{
		for (j=0;j<8;j++)								//repeat for 8 vertical line
		{
			lcd_xy(p_x/16,(p_y+j)%64);					//go to the location and y is re-adjust after adding j ( > 64 after adding j )
			send_char(0);								//send upperbyte with shifting according to the x position 
			send_char(0);								//send lowerbyte with shifting according to the x position 
		}
	}

	else
	{
		for (j=0;j<8;j++)
		{
			lcd_xy(p_x/16,(p_y+j)%64);					//go to the location and y is re-adjust after adding j ( > 64 after adding j )
			send_char (0);								//send dummy data to the upperbyte
			send_char(0);								//send lowerbyte data with shifting according to the x position 
			if(p_x/16 == 7) lcd_xy(0,p_y+j);
			send_char(0);								//send upperbyte of the next 'x' with shifting according to the x position 
		}
	}



	if (x%16 <8)										//if x position is on upper byte of 16 bit
	{
		for (j=0;j<8;j++)								//repeat for 8 vertical line
		{
			lcd_xy(x/16,(y+j)%64);						//go to the location and y is re-adjust after adding j ( > 64 after adding j )
			send_char(icon[j]>> x%8);					//send upperbyte with shifting according to the x position 
			send_char(icon[j]<< (8-x%8));				//send lowerbyte with shifting according to the x position 
		}
	}

	else
	{
		for (j=0;j<8;j++)
		{
			lcd_xy(x/16,(y+j)%64);						//go to the location and y is re-adjust after adding j ( > 64 after adding j )
			send_char (0);								//send dummy data to the upperbyte
			send_char(icon[j]>> x%8);					//send lowerbyte data with shifting according to the x position 
			if(x/16 == 7) lcd_xy(0,y+j);
			send_char(icon[j]<< (8-x%8));				//send upperbyte of the next 'x' with shifting according to the x position 
		}	
	}
	p_x = x;											//save as previous location
	p_y= y;												//save as previous location

}


void lcd_xy(unsigned char x,unsigned char y)			//set the xy position for graphic
{
		if( y >= 32)
		{												//if vertical more or equal 32
			send_config(0x80+y-32);						//adjust the vertical line
			send_config(0x80+x+8);						//for more detail refer GDRAM in user manual
		}

		else
		{
		 	send_config(0x80+y);						//vertical (Y) max 63
			send_config(0x80+x);						//horizontal (X) max 8 (horizontal is divided by 16 bit data (represented in 2 bytes))
		}
}

Post Reply