ILI9486(L) Controllers

This section covers GLCD devices that use the ILI9486(L) graphics controller.

The ILI9486(L) is a 262kcolor single-chip SoC driver for a-Si TFT liquid crystal display with resolution of 320RGBx480 dots, comprising a 960-channel source driver, a 480-channel gate driver, 345,600bytes GRAM for graphic data of 320RGBx480 dots.

The GCBASIC constants shown below control the configuration of the ILI9486(L) controller.    GCBASIC supports 1) SPI using the SPI hardware module, 2) software SPI, 3) UNO shields and 4) an 8bit port bus - this is detailed in the tables below.

GCBASIC supports 65K-color mode operations.

To use the ILI9486(L) driver simply include the following in your user code. This will initialise the driver.

    #include <glcd.h>
    #DEFINE GLCD_TYPE GLCD_TYPE_ILI9486L

The GCBASIC constants for the interface to the controller are shown in the table below.

Constants Controls Options

GLCD_TYPE

GLCD_TYPE_ILI9486L or GLCD_TYPE_ILI9486

 

GLCD_DC

Specifies the output pin that is connected to Data/Command IO pin on the GLCD.

Required

GLCD_CS

Specifies the output pin that is connected to Chip Select (CS) on the GLCD.

Required

GLCD_Reset

Specifies the output pin that is connected to Reset pin on the GLCD.

Required

GLCD_DI

Specifies the output pin that is connected to Data In (GLCD out) pin on the GLCD.

Required

GLCD_DO

Specifies the output pin that is connected to Data Out (GLCD in) pin on the GLCD.

Required

GLCD_SLK

Specifies the output pin that is connected to Clock (CLK) pin on the GLCD.

Required

The GCBASIC constants for the communicaton protocol for the controller are shown in the table below.

Communications Constants Use Comments

ILI9486L_HardwareSPI

Specifies that hardware SPI will be used

SPI ports MUST be defined that match the SPI module for each specific microcontroller

#define ILI9486L_HardwareSPI

HWSPIMode

Specifies the speed of the SPI communications for Hardware SPI only.

Optional defaults to MASTERFAST.

Options are MASTERSLOW,
MASTER,
MASTERFAST, or
MASTERULTRAFAST for specific AVRs only.

UNO_8bit_Shield

Specifies that a UNO shield will be used

The shield will use 13 ports. These ports are pre-defined by the shield. These ports must be specified.

#define UNO_8bit_Shield

GLCD_DataPort

Specifies that a full 8 port will be used

The microcontroller will use 13 ports. These port is defined as 8 contigous bits. These control port and the data port must be specified.

#define GLCD_DataPort portb

The GCBASIC constants for control display characteristics are shown in the table below.

Constants Controls Default

GLCD_WIDTH

The width parameter of the GLCD

320

GLCD_HEIGHT

The height parameter of the GLCD

480

GLCDFontWidth

Specifies the font width of the GCBASIC font set.

6

The GCBASIC commands supported for this GLCD are shown in the table below.   Always review the appropiate library for the latest full set of supported commands.

Command Purpose Example

GLCDCLS

Clear screen of GLCD

GLCDCLS

GLCDPrint

Print string of characters on GLCD using GCB font set

GLCDPrint( Xposition, Yposition, Stringvariable )

GLCDDrawChar

Print character on GLCD using GCB font set

GLCDDrawChar( Xposition, Yposition, CharCode [,Optional LineColour] )

GLCDDrawString

Print characters on GLCD using GCB font set

GLCDDrawString( Xposition, Yposition, Stringvariable [,Optional LineColour] )

Box

Draw a box on the GLCD to a specific size

Box ( Xposition1, Yposition1, Xposition2, Yposition2 [,Optional LineColour]

FilledBox

Draw a box on the GLCD to a specific size that is filled with the foreground colour.

FilledBox (Xposition1, Yposition1, Xposition2, Yposition2 [,Optional LineColour] )

Line

Draw a line on the GLCD to a specific length that is filled with the specific attribute.

Line ( Xposition1, Yposition1, Xposition2, Yposition2 [,Optional In LineColour] )

PSet

Set a pixel on the GLCD at a specific position that is set with the specific attribute.

PSet(Xposition, Yposition, Pixel Colour)

GLCDWriteByte

Set a byte value to the controller, see the datasheet for usage.

GLCDWriteByte ( LCDByte)

GLCDReadByte

Read a byte value from the controller, see the datasheet for usage.

bytevariable = GLCDReadByte

GLCDRotate

Rotate the display

LANDSCAPE, PORTRAIT_REV, LANDSCAPE_REV and PORTRAIT are supported

ILI9486L_[color]

Specify color as a parameter for many GLCD commands

Color constants for this device are shown in the list below.

Any color can be defined using a valid hexidecimal word value between 0x0000 to 0xFFFF.

    TFT_BLACK   'hexidecimal value 0x0000
    TFT_RED     'hexidecimal value 0xF800
    TFT_GREEN   'hexidecimal value 0x07E0
    TFT_BLUE    'hexidecimal value 0x001F
    TFT_WHITE   'hexidecimal value 0xFFFF
    TFT_PURPLE  'hexidecimal value 0xF11F
    TFT_YELLOW  'hexidecimal value 0xFFE0
    TFT_CYAN    'hexidecimal value 0x07FF
    TFT_D_GRAY  'hexidecimal value 0x528A
    TFT_L_GRAY  'hexidecimal value 0x7997
    TFT_SILVER  'hexidecimal value 0xC618
    TFT_MAROON  'hexidecimal value 0x8000
    TFT_OLIVE   'hexidecimal value 0x8400
    TFT_LIME    'hexidecimal value 0x07E0
    TFT_AQUA    'hexidecimal value 0x07FF
    TFT_TEAL    'hexidecimal value 0x0410
    TFT_NAVY    'hexidecimal value 0x0010
    TFT_FUCHSIA 'hexidecimal value 0xF81F

For a ILI9486L datasheet, please refer to Google.

This example shows how to drive a ILI9486L based Graphic LCD module with the built in commands of GCBASIC.

Example:

    #chip mega328p, 16
    #option explicit

    #include <glcd.h>
    #include <UNO_mega328p.h >

    #define GLCD_TYPE GLCD_TYPE_ILI9486L

    'Pin mappings for SPI - this GLCD driver supports Hardware SPI and Software SPI
    #define GLCD_DC       DIGITAL_8           ' Data command line
    #define GLCD_CS       DIGITAL_10          ' Chip select line
    #define GLCD_RST      DIGITAL_9           ' Reset line

    #define GLCD_DI       DIGITAL_13          ' Data in | MISO
    #define GLCD_DO       DIGITAL_11          ' Data out | MOSI
    #define GLCD_SCK      DIGITAL_13          ' Clock Line

    #define ILI9486L_HardwareSPI              ' Remove/comment out if you want to use software SPI.


    GLCDPrint(0, 0, "Test of the ILI9486L Device")
    end

For more help, see GLCDCLS, GLCDDrawChar, GLCDPrint, GLCDReadByte, GLCDWriteByte or Pset

Supported in <GLCD.H>