PreviousNext
Help > RITTLE FOR THE PIC32MZ MICROCONTROLLER > Specific Peripheral Modules > display
display

Format:

display (text_type, int_resH, int_resV);

Enable support, initialise, and attach specified display driver. If a SPI display module is used, it occupies the same pins as SPI2 as shown in the pinout, plus two additional pins for display RESET and D/C signals.

 

Connections for SPI display

                                     SPI LCD Module
--------------\                /------------------------\
          P22 |--- MISO -------| MISO (SDO in some)     |
          P23 |--- MOSI -------| MOSI (SDA in some)     |
PIC32MZ   P24 |--- D/C# -------| DC   (A0 in some)      |
          P27 |--- RESET# -----| RES                    |
          P28 |--- CS# --------| CS                     |
          P29 |--- SCLK -------| SCLK (SCL in some)     |
--------------/                \------------------------/

Connections for 8-bit display

                                  8-bit bus LCD Module
--------------\                /------------------------\
          P21 |--- DB0 --------| D0                     |
          P22 |--- DB1 --------| D1                     |
PIC32MZ   P23 |--- DB2 --------| D2                     |
          P24 |--- DB3 --------| D3                     |
          P27 |--- DB4 --------| D4                     |
          P28 |--- DB5 --------| D5                     |
          P29 |--- DB6 --------| D6                     |
          P30 |--- DB7 --------| D7                     |
              |                |                        |
          P58 |--- RESET# -----| RESET (optional)       |
          P61 |--- D/C# -------| D/C                    |
          P62 |--- RD# --------| RD                     |
          P63 |--- WR# --------| WR                     |
          P64 |--- CS# --------| CS                     |
--------------/                \------------------------/

Some displays may not require one of more of the control signals. In such case those signals can be left floating, however Rittle will still be driving them in a way as if they are being used by the display.

An exception to this are the HD44780-based text display modules as they use a different type of interface. Connections to those displays are described in the paragraph for LCD4.

The first text parameter for the function specifies the display controller model.

Currently supported displays are:

NULL”                      Null device. All currently attached display driver functions are detached and released with console remaining the single output destination. The parameters for display resolution have no meaning, and orientation is always the native for the console.

 

 “HD44780”             NOTE: The parameter “HD44780” can be aliased as “LCD4”.

Alphanumeric LCD with HD44780-compatible controller on 4-bit bus as described for the LCD4() function.

                                    These displays support only their native orientation, and their minimal addressable component is character, not pixel.

                                    Supported resolutions (in characters) are from 8 to 40 for resH, and from 1 to 8 for resV.

 

LRSPI*”                   Covers the majority of popular display modules using controllers such as ST7735, ST7789, ILI9163, ILI9341, ILI9481, ILI9488, and many others from other manufacturers. These displays have resolutions up to 320x480 pixels, or smaller. They only support hardware scrolling in portrait mode, and for full support, in landscape mode the image scroll is handled in software, so presence of the MISO (or SDO) pin is required, otherwise all graphics will work, but the system console will not be properly supported.

 

MLRSPI*”               This driver is the same as LRSPI* but supports displays with internally mirrored graphic matrix.

 

SSD196*”               Support for displays with SSD1961 / SSD1962 / SSD1963 controller and connected on the 8-bit bus. These are usually built around SSD1963 with lot of internal graphic memory. They are also able to perform fast scroll in all directions, so console performance in landscape mode will not suffer as in the case with the SPI displays.

 

MSSD196*”           Same as the “SSD196*” driver but with mirrored graphic matrix.

 

The following two parameters are numeric and define respectively the horizontal (resH) and vertical (resV) resolution of the display in number of the smallest addressable component. Normally that is “pixel”, but for text-only displays, it is “character”.

Horizontal and vertical resolution parameters must match the specifications of the particular display panel, otherwise it won’t work properly.

Orientation of the panel is calculated automatically on the basis of the given parameters for display resolution.

When the horizontal resolution is greater than the vertical resolution, the display is in LANDSCAPE mode, otherwise, if the vertical resolution is greater than the horizontal, the display is in PORTRAIT mode.

If any of the two following parameters for resolution is given as a negative number, then the image of the display is mirrored, reverse landscape or reverse portrait.

In an isolated case when the horizontal resolution is exactly the same as the vertical resolution, the orientation is determined by the sign of both parameters as per the following table:

Positive resH, Positive resV         LANDSCAPE mode
Positive resH, Negative resV      
Reversed LANDSCAPE mode
Negative resH, Positive resV      
PORTRAIT mode
Negative resH, Negative resV    
Reversed PORTRAIT mode

Text-only and a small number of graphic displays do not support different orientation modes. Those displays will work only in their native mode of orientation regardless the sign of the “resH” and “resV” parameters.

 

There is another accepted form for the display() function.

display (“CONSOLE”, int_fontFcol, int_fontScale);

 

This one is not to install a display driver, but instead, delivers instructions to the currently installed driver. The first parameter specifies 24-bit colour for the text font in the system console (the background is automatically initialised as black colour), and the second parameter specifies the scale for the system font.

If both parameters are greater than zero, system console output is enabled for the currently attached display device.

If any of the parameters is zero or negative number, the system console output for the attached display will be disabled.

This has no effect on the system console attached to the USB or serial port.