Home > other >  Set the cursor function question about TFTLCD
Set the cursor function question about TFTLCD

Time:09-16

//set the cursor position
Abscissa//Xpos:
//Ypos: ordinate

LCD_SetCursor (under-16 Xpos, under-16 Ypos)
{
If (lcddev. Id==0 x9341 | | lcddev. Id==0 x5310)
{
LCD_WR_REG (lcddev setxcmd);
LCD_WR_DATA (Xpos> 8); LCD_WR_DATA (Xpos& 0 XFF);
LCD_WR_REG (lcddev setycmd);
LCD_WR_DATA (Ypos> 8); LCD_WR_DATA (Ypos& 0 XFF);
} else if (lcddev. Id==0 x6804)
{
If (lcddev. Dir==1). Xpos=lcddev width - 1 - Xpos;//landscape processing
LCD_WR_REG (lcddev setxcmd);
LCD_WR_DATA (Xpos> 8); LCD_WR_DATA (Xpos& 0 XFF);
LCD_WR_REG (lcddev setycmd);
LCD_WR_DATA (Ypos> 8); LCD_WR_DATA (Ypos& 0 XFF);
} else if (lcddev. Id==0 x1963)
{
If (lcddev. Dir==0)//x coordinate to transform
{
Xpos=lcddev. Width - 1 - Xpos;
LCD_WR_REG (lcddev setxcmd);
LCD_WR_DATA (0); LCD_WR_DATA (0);
LCD_WR_DATA (Xpos> 8); LCD_WR_DATA (Xpos& 0 XFF);
} the else
{
LCD_WR_REG (lcddev setxcmd);
LCD_WR_DATA (Xpos> 8); LCD_WR_DATA (Xpos& 0 XFF);
LCD_WR_DATA ((lcddev. Width - 1) & gt;> 8); LCD_WR_DATA ((lcddev. Width - 1) & amp; 0 XFF);
}
LCD_WR_REG (lcddev setycmd);
LCD_WR_DATA (Ypos> 8); LCD_WR_DATA (Ypos& 0 XFF);
LCD_WR_DATA ((lcddev. Height - 1) & gt;> 8); LCD_WR_DATA ((lcddev. Height - 1) & amp; 0 XFF);

} else if (lcddev. Id==0 x5510)
{
LCD_WR_REG (lcddev setxcmd); LCD_WR_DATA (Xpos> 8);
LCD_WR_REG (lcddev. Setxcmd + 1); LCD_WR_DATA (Xpos& 0 XFF);
LCD_WR_REG (lcddev setycmd); LCD_WR_DATA (Ypos> 8);
LCD_WR_REG (lcddev. Setycmd + 1); LCD_WR_DATA (Ypos& 0 XFF);
} the else
{
If (lcddev. Dir==1). Xpos=lcddev width - 1 - Xpos;//landscape is actually turned the x, y coordinates
LCD_WriteReg (lcddev setxcmd Xpos);
LCD_WriteReg (lcddev setycmd, Ypos);
}
}


Excuse me each great god, he this function should be used with draw point function, cannot be used and display function of the characters??






CodePudding user response:

Well, it seems that only for different reality ping function display the cursor position, in a specific location display character only need to consider whether pixels is enough, not just on the edge
  • Related