ILI9481 Controllers

This section covers GLCD devices that use the ILI9481 graphics controller.

ILI9481 is a 262,144-color single-chip SoC driver for a-TFT liquid crystal display with resolution of 320RGBx480 dots, comprising a 960-channel source driver, a 480-channel gate driver, 345,600 bytes GRAM for graphic data.

The Great Cow BASIC constants shown below control the configuration of the ILI9481 controller.    The Great Cow BASIC constants for control of the connectivity are shown in the table below. The only connectivity option the 8-bit mode where 8 pins are connected between the microcontroller and the GLCD to control the data bus.

To use the ILI9481 driver simply include the following in your user code. This will initialise the driver.

    #include <glcd.h>
    #DEFINE GLCD_TYPE GLCD_TYPE_ILI9481

    'Pin mappings for SPI - this GLCD driver supports Hardware SPI and Software SPI
    #define GLCD_RD       ANALOG_0          ' read command line
    #define GLCD_WR       ANALOG_1          ' write command line
    #define GLCD_RS       ANALOG_2          ' Command/Data line
    #define GLCD_CS       ANALOG_3          ' Chip select line
    #define GLCD_RST      ANALOG_4          ' Reset line

    #define GLCD_DB0       DIGITAL_8        'Data port'
    #define GLCD_DB1       DIGITAL_9        'Data port'
    #define GLCD_DB2       DIGITAL_2        'Data port'
    #define GLCD_DB3       DIGITAL_3        'Data port'
    #define GLCD_DB4       DIGITAL_4        'Data port'
    #define GLCD_DB5       DIGITAL_5        'Data port'
    #define GLCD_DB6       DIGITAL_6        'Data port'
    #define GLCD_DB7       DIGITAL_7        'Data port'

The Great Cow BASIC constants for the interface to the controller are shown in the table below.

Constants Controls Options

GLCD_TYPE

GLCD_TYPE_ILI9481

 

GLCD_DB0..7

Specifies the pin that is connected to DB0..7 IO pin on the GLCD.

Required

GLCD_RST

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

Required

GLCD_CS

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

Required

GLCD_RS

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

Required

GLCD_RW

Specifies the output pin that is connected to Data In (RW or WDR) pin on the GLCD.

Required

GLCD_RD

Specifies the output pin that is connected to Data Out (RD or RDR) pin on the GLCD.

Required

The Great Cow BASIC 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

240

GLCDFontWidth

Specifies the font width of the Great Cow BASIC font set.

6

The Great Cow BASIC 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 )

GLCDDrawString

Print characters on GLCD using GCB font set

GLCDDrawString( Xposition, Yposition, Stringvariable )

Box

Draw a box on the GLCD to a specific size

Box ( Xposition1, Yposition1, Xposition2, Yposition2, [Optional In LineColour as 0 or 1]

FilledBox

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

FilledBox (Xposition1, Yposition1, Xposition2, Yposition2, [Optional In LineColour 0 or 1] )

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 0 or 1] )

PSet

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

PSet(Xposition, Yposition, Pixel Colour 0 or 1)

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

ILI9481_[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.

    ILI9481_BLACK   'hexidecimal value 0x0000
    ILI9481_RED     'hexidecimal value 0xF800
    ILI9481_GREEN   'hexidecimal value 0x07E0
    ILI9481_BLUE    'hexidecimal value 0x001F
    ILI9481_WHITE   'hexidecimal value 0xFFFF
    ILI9481_PURPLE  'hexidecimal value 0xF11F
    ILI9481_YELLOW  'hexidecimal value 0xFFE0
    ILI9481_CYAN    'hexidecimal value 0x07FF
    ILI9481_D_GRAY  'hexidecimal value 0x528A
    ILI9481_L_GRAY  'hexidecimal value 0x7997
    ILI9481_SILVER  'hexidecimal value 0xC618
    ILI9481_MAROON  'hexidecimal value 0x8000
    ILI9481_OLIVE   'hexidecimal value 0x8400
    ILI9481_LIME    'hexidecimal value 0x07E0
    ILI9481_AQUA    'hexidecimal value 0x07FF
    ILI9481_TEAL    'hexidecimal value 0x0410
    ILI9481_NAVY    'hexidecimal value 0x0010
    ILI9481_FUCHSIA 'hexidecimal value 0xF81F

This example shows how to drive a ILI9481 based Graphic LCD module with the built in commands of Great Cow BASIC. This example uses a UNO shield, this can easily adapted to Microchip architecture.

Example:

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

    #define GLCD_TYPE GLCD_TYPE_ILI9481

    'Pin mappings for SPI - this GLCD driver supports Hardware SPI and Software SPI
    #define GLCD_RD       ANALOG_0          ' read command line
    #define GLCD_WR       ANALOG_1          ' write command line
    #define GLCD_RS       ANALOG_2          ' Command/Data line
    #define GLCD_CS       ANALOG_3          ' Chip select line
    #define GLCD_RST      ANALOG_4          ' Reset line

    #define GLCD_DB0       DIGITAL_8
    #define GLCD_DB1       DIGITAL_9
    #define GLCD_DB2       DIGITAL_2
    #define GLCD_DB3       DIGITAL_3
    #define GLCD_DB4       DIGITAL_4
    #define GLCD_DB5       DIGITAL_5
    #define GLCD_DB6       DIGITAL_6
    #define GLCD_DB7       DIGITAL_7

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

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

Supported in <GLCD.H>