TFT lcd ler için kalibrasyon işlemi kod örneği

Başlatan XX_CİHAN_XX, 28 Şubat 2013, 05:12:43

XX_CİHAN_XX

TFT lerde kalibrasyon olayına örnek kod yada kalibrasyon işlemini nasıl yapmak gerektiğinin mantığını anlatan bilgi arıyorum.
Yirmi yaşındaki bir insan, dünyayı değiştirmek ister . Yetmiş yaşına gelince , yine dünyayı değiştirmek ister, ama yapamayacağını bilir.


diot

@XX_CİHAN_XX  ;
Aşağıdaki kodları bir incele istersen.

void Touch_Adjust(void)
{								 
	uint16_t pos_temp[4][2];
	uint8_t  cnt=0;	
	uint16_t d1,d2;
	uint32_t tem1,tem2;
	float fac; 	   
	cnt=0;				
	LCD_SetTextColor(BLUE);
	LCD_SetTextColor(WHITE);
	LCD_Clear(WHITE);
	Drow_Touch_Point(20,20);
	Pen_Point.xfac=0;
	while(1)
	{
                if(1==1)
		//if(Pen_Point.Key_Sta==Key_Down)
		{
			if(Read_Ads7846())
			{  								   
				pos_temp[cnt][0]=Pen_Point.X;
				pos_temp[cnt][1]=Pen_Point.Y;
				cnt++;
                                Delay(0xFFFF);
			}			 
			switch(cnt)
			{			   
				case 1:
					LCD_Clear(WHITE);
					Drow_Touch_Point(210,20);
					break;
				case 2:
					LCD_Clear(WHITE);
					Drow_Touch_Point(20,300);
					break;
				case 3:
					LCD_Clear(WHITE);
					Drow_Touch_Point(210,300);
					break;
				case 4:
					tem1=abs(pos_temp[0][0]-pos_temp[1][0]);
					tem2=abs(pos_temp[0][1]-pos_temp[1][1]);
					tem1*=tem1;
					tem2*=tem2;
					d1=sqrt(tem1+tem2);
					
					tem1=abs(pos_temp[2][0]-pos_temp[3][0]);
					tem2=abs(pos_temp[2][1]-pos_temp[3][1]);
					tem1*=tem1;
					tem2*=tem2;
					d2=sqrt(tem1+tem2);
					fac=(float)d1/d2;
					if(fac<0.75||fac>1.25||d1==0||d2==0)
					{
						cnt=0;
						LCD_Clear(WHITE);
						Drow_Touch_Point(20,20);
						continue;
					}
					tem1=abs(pos_temp[0][0]-pos_temp[2][0]);
					tem2=abs(pos_temp[0][1]-pos_temp[2][1]);
					tem1*=tem1;
					tem2*=tem2;
					d1=sqrt(tem1+tem2);
					
					tem1=abs(pos_temp[1][0]-pos_temp[3][0]);
					tem2=abs(pos_temp[1][1]-pos_temp[3][1]);
					tem1*=tem1;
					tem2*=tem2;
					d2=sqrt(tem1+tem2);
					fac=(float)d1/d2;
					if(fac<0.75||fac>1.25)
					{
						cnt=0;
						LCD_Clear(WHITE);
						Drow_Touch_Point(20,20);
						continue;
					}
					tem1=abs(pos_temp[1][0]-pos_temp[2][0]);
					tem2=abs(pos_temp[1][1]-pos_temp[2][1]);
					tem1*=tem1;
					tem2*=tem2;
					d1=sqrt(tem1+tem2);
	
					tem1=abs(pos_temp[0][0]-pos_temp[3][0]);
					tem2=abs(pos_temp[0][1]-pos_temp[3][1]);
					tem1*=tem1;
					tem2*=tem2;
					d2=sqrt(tem1+tem2);
					fac=(float)d1/d2;
					if(fac<0.75||fac>1.25)
					{
						cnt=0;
						LCD_Clear(WHITE);
						Drow_Touch_Point(20,20);
						continue;
					}
					Pen_Point.xfac=(float)200/(pos_temp[1][0]-pos_temp[0][0]);
					Pen_Point.xoff=(240-Pen_Point.xfac*(pos_temp[1][0]+pos_temp[0][0]))/2;

					Pen_Point.yfac=(float)280/(pos_temp[2][1]-pos_temp[0][1]);
					Pen_Point.yoff=(320-Pen_Point.yfac*(pos_temp[2][1]+pos_temp[0][1]))/2;
					LCD_Clear(WHITE);
					return ;


			}
		}
	}
}

mesmert

Arkadaşlar  konuyu bölmeden sizden ricam  ADS7846 için örnek kodu verebilirmisiniz. ADS7846 yurt içinde bulunuyormu?

diot

#4
lcd:ssd1289
touch 7846 veya uyumlular
https://hotfile.com/dl/196366631/ba3a306/touch_lcd.rar.html
ads7846 yerine ,     XPT2046 kullanabilirsin ve türkiyede satışı var.