GLCD

From Flowcode Help
Revision as of 11:17, 30 May 2024 by BenR (talk | contribs) (→‎Reset)
Jump to navigationJump to search

Types of graphical display

Monochrome

These displays are typically arrays of pixels that can be either switched on or off.

They tend to be fast to refresh and low cost but are limited in terms of what they can display.

Colour

These displays are typically arrays of pixels that have associated red, green and blue colour channels. Each colour channel will have a bit depth that dictates what resolution is available for that colour. A common colour bit depth is 565 where the red and blue colour channels have 5 bits (0-31) and the green colour channel has 6 bits (0-63), making a total of 16-bits that are easily transferred using two standard 8-bit byte transfers.

The GLCD component is aware of the colour depth of the display and will automatically convert and scale the assigned RGB colour byte (0-255) to the correct bit depth.

They tend to be slower to refresh due to the increased data per pixel and slightly higher cost but can display full colour images.

Serial

Serial displays have a pin for clock and a pin for data in. The data is transferred a single bit at a time by placing the data onto the data pin and then strobing the clock pin.

These types of display consume less pins of the host microcontroller but tend to be slower as you have to individually clock in each bit.

Often these types of display can be used with an SPI peripheral to help speed up the data flow into the display. This is because the SPI peripheral can often output data much faster then simple pin toggling.

On some microcontrollers the SPI can run much faster if you can give it a burst of data rather then byte by byte. For larger displays there are properties named Queue Fast Pixels and when enabled you can set how many pixels will be buffered and transferred in a single chunk.

Parallel

Parallel displays often have a number of data pins up to 8 or 16 and a single clock pin. The data is transferred in multiple bits at a time by placing the data onto the data pins and then strobing the clock pin.

Ideally when using parallel displays you would assign the data pins to a port of the microcontroller which then allows you to write to all the data pins in a single operation, significantly increasing the speed of sending data to the display.

The downside to this is you require a lot more connections to the host microcontroller.

Other Control Pins

RS / CD / RE / A0

This pin can have several names register select (RS), command data (CD), register enable (RE), Address0 (A0). They all do the same thing and simply tell the display if you are transferring a register address or a data value.

CS

The Chip Select pin is there to tell the display if you are talking to it. It is common practise to tie this to ground if the display is always enabled.

For systems where the display is on a shared SPI bus it is a requirement to use the CS pin to control when you are communicating to the display and when you are communicating with other equipment.

The display component properties will have an option to let you determine if CS pin is used and if it is actively toggled.

UseCS = No - don't do anything with the CS pin, user must tie the CS pin to Ground or control it themselves.

UseCS = Yes - ToggleCS = No - Pull the CS pin low during the component initialise (enabled) and then don't do anything else with the pin. Allows future flexibility but avoids slowdown due to no instructions for toggling the CS pin.

UseCS = Yes - ToggleCS = Yes - Pull the CS pin high during the component initialise (disabled) then automatically toggle the pin to enabled when communicating with the display before toggling back to disabled.

Reset

The reset pin is used to reset the display back to a known condition, essentially resetting all the registers back to factory default.

The reset pin is often strobed during initialisation and then held high.

If you do not wish to connect the reset pin to the microcontroller then you can simply connect it to the VCC power rail.

Core Functions

Additional Libraries

Examples

Changing the display

If you want to replace the display in one of the examples with a different display type then information on how to do this can be found on the Replacing a Component page.