8-Bit Wiring
Wiring up the 8-bit mode is kind of a pain, so we really only recommend doing it for UNO (which we show) and Mega (which we describe, and is pretty easy since its 8 pins in a row). Anything else, like a Leonardo or Micro, we strongly recommend going with SPI mode since we don't have an example for that. Any other kind of 'Arduino compatible' that isn't an Uno, try SPI first. The 8-bit mode is hand-tweaked in the Adafruit_TFTLCD pin_magic.h file. Its really only for advanced users who are totally cool with figuring out bitmasks for various ports & pins.
Really, we'll show how to do the UNO but anything else? go with SPI!
Part 1 - Power & backlight test
Begin by wiring up the 3-5VDC and GND pins.
Connect the 3-5V pin to 5V and GND to GND on your Arduino. I'm using the breadboard rails but you can also just wire directly.
Power it up and you should see the white backlight come on.
Part 2 - Data Bus Lines
Now that the backlight is working, we can get the TFT LCD working. There are many pins required, and to keep the code running fairly fast, we have 'hardcoded' Arduino digital pins #2-#9 for the 8 data lines.
However, they are not in that order! D0 and D1 go to digital #8 and #9, then D2-D7 connect to #2 thru #7. This is because Arduino pins #0 and #1 are used for serial data so we can't use them
Begin by connecting D0 and D1 to digital #8 and 9 respectively as seen above. If you're using a Mega, connect the TFT Data Pins D0-D1 to Mega pins #22-23, in that order. Those Mega pins are on the 'double' header.
Now you can connect the remaining 6 pins over. Connect D2-D7 on the TFT pins to digital 2 thru 7 in that order. If you're using a Mega, connect the TFT Data Pins D2-D7 to Mega pins #24-29, in that order. Those Mega pins are on the 'double' header.
In addition to the 8 data lines, you'll also need 4 or 5 control lines. These can later be reassigned to any digital pins, they're just what we have in the tutorial by default.
- Connect the third pin CS (Chip Select) to Analog 3
- Connect the fourth pin C/D (Command/Data) to Analog 2
- Connect the fifth pin WR (Write) to Analog 1
- Connect the sixth pin RD (Read) to Analog 0
You can connect the seventh pin RST (Reset) to the Arduino Reset line if you'd like. This will reset the panel when the Arduino is Reset. You can also use a digital pin for the LCD reset if you want to manually reset. There's auto-reset circuitry on the board so you probably don't need to use this pin at all and leave it disconnected
The RD pin is used to read the chip ID off the TFT. Later, once you get it all working, you can remove this pin and the ID test, although we suggest keeping it since its useful for debugging your wiring. OK! Now we can run some code
8-Bit Library Install
We have example code ready to go for use with these TFTs. It's written for Arduino, which should be portable to any microcontroller by adapting the C++ source.
Two libraries need to be downloaded and installed: the TFTLCD library and the GFX library. You can install these libraries through the Arduino library manager.
Open up the Arduino library manager:
Search for the Adafruit GFX library and install it:
If using an older Arduino IDE (pre-1.8.10), do the same for Adafruit_BusIO (newer versions do this one automatically).
Then search for the Adafruit TFTLCD library and install it:
We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use
After restarting the Arduino software, you should see a new example folder called Adafruit_TFTLCD and inside, an example called graphicstest. Upload that sketch to your Arduino. You may need to press the Reset button to reset the arduino and TFT. You should see a collection of graphical tests draw out on the TFT.
If you're having difficulties, check the serial console.The first thing the sketch does is read the driver code from the TFT. It should be 0x9341 (for the ILI9341 controller inside)
If you Unknown Driver Chip then it's probably something with your wiring, double check and try again!
Text editor powered by tinymce.