-2
\$\begingroup\$

How do I write code for a 24-bit RGB TFT LCD display (if possible, also for touch-screen use)? I'm using a PIC18F microcontroller to interface with the LCD driver/controller. The microcontroller isn't driving the LCD itself.

I'm considering a number of 5" TFT LCD displays, including modules from P-Tec and from New Haven Display. They each have controllers/drivers. I can only find small code snippets describing how to interface with these displays.

\$\endgroup\$

closed as off-topic by Dmitry Grigoryev, Enric Blanco, PeterJ, Wesley Lee, JRE Jul 1 '17 at 16:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    \$\begingroup\$ Read the datasheet. Then you're not stuck having to use code you find lying around somewhere. When you actually understand the device you're trying to drive, you can write your own code. \$\endgroup\$ – Olin Lathrop Jun 26 '17 at 12:47
  • 1
    \$\begingroup\$ The ability to reuse existing code is actually a great skill to have. Unfortunately, we don't do tutorials or library recommendations here. \$\endgroup\$ – Dmitry Grigoryev Jun 26 '17 at 12:55
  • \$\begingroup\$ Reusing code is good if you have something available that is the perfect answer to your need. There's no use reinventing the wheel. I also though agree with Olin, that using wheels others have invented without knowing how to make a wheel yourself is a serious limitation. If you have the time to code from the ground up, you'll be all the better for it, and creating custom applications becomes a skill you have. My personal view is that at the level of MCUs, code is generally something the individual can write themself. In that regard they are much like the heyday of the 8/16 bit "home micro". \$\endgroup\$ – Ian Bland Jun 26 '17 at 13:25
  • \$\begingroup\$ @IanBland - yes, reusing code is a fine, but off-topic, skill. \$\endgroup\$ – Scott Seidman Jun 26 '17 at 14:31
1
\$\begingroup\$

A PIC16 is way out of its depth driving displays like those. Although they have a controller on board, it's really only there to provide the correct timing, multiplexing and electrical drive signals for the individual LCD segments. Those displays are like TV or monitor screens, and have to be fed with a continuous stream of data on the 24 bit parallel interface while providing horizontal and vertical synchronisation signals to allow the display to know which pixels to send it to.

That in turn means you need to use a block of memory as a buffer to hold the image that you want displayed, and be constantly reading it and feeding it to the display three bytes at a time. An 800x480 display will need 3x800x480 bytes, i.e. just over 1MByte of memory to hold the image, which is why it's really not practical on a basic eight bit family such as the PIC16F, even if there were a model in the range with enough I/O pins.

Although you could find a more complex microcontroller or design your own display circuits, a simpler way is to find a display that uses a far more advanced controller, incorporating a sufficiently large frame buffer, and that provides a simpler interface using a serial port, I2C, SPI or 8 bit parallel port and accepts instructions from your microcontroller to do things like set individual pixels, clear the screen, possibly even draw text characters and graphic elements such as polygons and fill them.

Take a look at some of the displays available for things like the Arduino or Raspberry Pi, you should be able to get the driver source as well to help you get started.

\$\endgroup\$
  • \$\begingroup\$ Thanks for the reply. I'd like to add that the interface would be between the microcontroller and the LCD driver/controller. The microcontroller isn't driving the LCD itself. \$\endgroup\$ – boseag Jun 26 '17 at 13:40
  • 1
    \$\begingroup\$ Ah, but you didn't think it was relevant to include that in the question? \$\endgroup\$ – Finbarr Jun 26 '17 at 13:45
  • \$\begingroup\$ I did? "Both of these displays have controllers/drivers." \$\endgroup\$ – boseag Jun 26 '17 at 14:03
  • \$\begingroup\$ How ARE you planning to connect one of the display modules in the links you gave directly to a PIC16? \$\endgroup\$ – Finbarr Jun 26 '17 at 14:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.