I want to copy this: Arduino Project Hub but I don't have Adafruit LCD. I have a 3.2" (ID below) If I try the code as-is, I get blank white screen. With a minor change I was able to get it to work:
#include <Adafruit_TFTLCD.h>
#include <stdint.h>
#include "TouchScreen.h"
#include <avr/pgmspace.h>
#include <EEPROM.h>
#include <MCUFRIEND_kbv.h>
MCUFRIEND_kbv tft;
//Adafruit_TFTLCD tft; (removed this since it'd conflict with MCUfriend library)
#define YP A3 // changed these 4 pins to match my LCD
#define XM A2
#define YM 9
#define XP 8
I used MCUfriend library for my LCD and I got the display to work but touch feature does not work. It seems backward on the X axis. If I touched something on the right side, it registers something on the left instead. Y axis seems correct.
ID from LCD #1:
Read Registers on MCUFRIEND UNO shield
controllers either read as single 16-bit
e.g. the ID is at readReg(0)
or as a sequence of 8-bit values
in special locations (first is dummy)
reg(0x0000) 00 00 ID: ILI9320, ILI9325, ILI9335, ...
reg(0x0004) 00 00 00 00 Manufacturer ID
reg(0x0009) 00 00 61 00 00 Status Register
reg(0x000A) 00 08 Get Power Mode
reg(0x000C) 00 06 Get Pixel Format
reg(0x0061) 00 00 RDID1 HX8347-G
reg(0x0062) 00 00 RDID2 HX8347-G
reg(0x0063) 00 00 RDID3 HX8347-G
reg(0x0064) 00 00 RDID1 HX8347-A
reg(0x0065) 00 00 RDID2 HX8347-A
reg(0x0066) 00 00 RDID3 HX8347-A
reg(0x0067) 00 00 RDID Himax HX8347-A
reg(0x0070) 00 00 Panel Himax HX8347-A
reg(0x00A1) 00 00 00 00 00 RD_DDB SSD1963
reg(0x00B0) 00 00 RGB Interface Signal Control
reg(0x00B4) 00 02 Inversion Control
reg(0x00B6) 00 0A 82 27 04 Display Control
reg(0x00B7) 00 06 Entry Mode Set
reg(0x00BF) 00 00 00 00 00 00 ILI9481, HX8357-B
reg(0x00C0) 00 21 00 00 00 00 00 00 00 Panel Control
reg(0x00C8) 00 00 00 00 00 00 00 00 00 00 00 00 00 GAMMA
reg(0x00CC) 00 71 Panel Control
reg(0x00D0) 00 00 00 Power Control
reg(0x00D2) 00 00 00 01 01 NVM Read
reg(0x00D3) 00 00 93 41 ILI9341, ILI9488
reg(0x00D4) 00 00 00 00 Novatek ID
reg(0x00DA) 00 00 RDID1
reg(0x00DB) 00 00 RDID2
reg(0x00DC) 00 00 RDID3
reg(0x00E0) 00 0F 16 14 0A 0D 06 43 75 33 06 0E 00 0C 09 08 GAMMA-P
reg(0x00E1) 00 08 2B 2D 04 10 04 3E 24 4E 04 0F 0E 35 38 0F GAMMA-N
reg(0x00EF) 00 03 80 02 02 02 ILI9327
reg(0x00F2) 00 02 02 02 02 02 02 02 02 02 02 02 Adjust Control 2
reg(0x00F6) 00 01 00 00 Interface Control
I have another LCD but uses different pinout and seller that sold it is completely clueless. The second LCD I have needs Mega LCD board and the pinout seller provided is for Uno version that doesn't work with Mega version of LCD so I don't know which pins goes to where yet. The LCD itself is a separate 40-pin board. I don't think MCUFriend works with Mega only pinout, the D22-D53 end. I have a 40-pin LCD to UNO shield coming but it's about 3 or 4 weeks via China snail post.
Any help please with the touch coordinate on X axis?