HOME Technical Tips  


Using PIC18F2550 for connecting LCD TFT module to USB port .

WinUSB Driver and VS2005 software
Included PIC software based on LVR software for winUSB generic driver. The PC software using Visual Basic 2005 is based on LVR version. This driver allows data transfer at a speed of 120KB/s and the screen is loaded in 2 seconds.
After connecting the programmed PIC to the PC you need to install the driver, use the INF file that included. For the missing files you can download Microchip USB framework, all the needed files are there, http://ww1.microchip.com/downloads/en/devicedoc/MCHP_App_%20Lib%20v2010_02_09_Installer.zip

VB6 and HID class USB software
Also included Visual Basic 6 code and PIC C code that interfaces the PC in HID class. HID class (human interface device) is a class of devices like the mouse and the keyboard, the data transfer rate is limited to 64KB/S. The PC already has a driver for HID USB.The screen loads in about 1 minute.
VB6 code includes guidance to setting up the PC. The PC register the PID and VID (product ID) of the USB device when it's plugged, the VB code uses these ID's to communicate with the device. For commercial VID it is needed to buy it from USB-IF, but in your lab you can use any number.

LCD TFT Module used is 8 bits drive. Inputs to the TFT driver are level shifted from 5V to 3.3V by buffers. The LCD driver is ILI9341.
The pic firmware can read only bitmap file of 24 bits bmp type. The file has to be size of 240 pixels width and 320 pixels high. The firmware removes the bitmap header (54 bytes) and then streams the rest of the file to the TFT. Every 3 bytes are the 24 bits color for one pixel. The bitmap format reads and displays the pixels of the image starting from bottom left.
To create a *.bmp file shrink the picture to 240 pixel wide and 320 pixel high, save it as 24 bit bitmap. You can use MS Paint.

The source code is derived from freeware from these sources: http://janaxelson.com/usb.htm , http://openprog.altervista.org/USB_firm_eng.html
Code was compiled with C18 ver 3.30. PIC18F2550 was programmed using Velleman K8076 or PICKIT2.
Software includes PIC code and VB code.




Circuit Description
See also Technical Tips

RD input is connected to 3.3V on the TFT module.
RST is the RESET of the TFT Module.
The module supply is 5V. The LCD driver I have is ILI9341.
Pin 14 is 3.3V internal supply for the USB transceiver. 0.22uF is required for regulation.
Pins 21 to 28 are port B outputs.
Pins 15,16 are the data lines to the USB connector on the PC.
Pin 20 is the PC 5V powering the PIC and the TFT module. It is limited to 100mA by the PC. 0.47uF is for decoupling.
For USB wiring info: http://www.interfacebus.com/Design_Connector_USB.html


Comments and questions

Copy the number from the picture It stops net-robots from adding comments.

21.10.2015 - 12:29
Name: Moty
Comment: Hi KansaiRobot. That is right , you need a library stored in the program memory for all the shapes. You can copy libs from other freeware codes. pic16 ROM is too small for text lib.

16.10.2015 - 12:21
Name: Moty
Comment: http://www.banggood.com/2_4-Inch-TFT-LCD-Shield-Touch-Board-Display-Module-For-Arduino-UNO-p-940735.html I've ordered this and they sent a board that looks similar but with different driver. In another order they sent me 2 faulty TFT modules so I stopped dealing with them and I recommended to others to be aware. You have to look for a module with ILI9341 drive chip. I can't recommend a reliable Chinese source. Look at this one: http://www.ebay.com/itm/2-2-inch-SPI-TFT-LCD-Display-module-240x320-ILI9341-51-AVR-STM32-ARM-PIC-New-/161805634644?hash=item25ac5e0c54:g:424AAOSwd0BV3Sgh

16.10.2015 - 02:43
Name: KansaiRobot
Comment: Very nice blog. Btw, can you post a link to the TFT LCD you used for this project?? Thanks

iconFlag Countermoty22.co.uk  2008-2022