Synergy Software Package User's Manual
Segment LCD Driver

SLCDC HAL Module Introduction

The Segment LCD HAL module provides a high-level API for Segment LCD applications and displays and modifies data on a Segment LCD. The Segment LCD HAL module uses the Segment LCD Controller module on a Synergy MCU.

SLCDC HAL Module Features

  • Internal voltage-boosting for the LCD driver voltage generator: select the capacitor split method or the external resistance division.
  • Display bias: select the 1/2 bias method, 1/3 bias method, or 1/4 bias method.
  • Time slice of the display: select static, 2-time slice, 3-time slice, 4-time slice, or 8-time slice.
  • Display waveform: select waveform A or waveform B.
  • Display data area: select A-pattern, B-pattern, or blinking. You can switch the display data area.
  • Use the RTC periodic interrupt (PRD) to generate a blinking display with A-pattern and B-pattern.
  • Adjust the reference voltage which is generated when operating the voltage boost circuit in 16 steps (contrast adjustment.)
SLCDC_BD.png
SLCDC HAL Module Block Diagram

SLCDC Hardware Support Details

The following hardware features are, or are not, supported by SSP for the SLCD.

Legend:

Symbol Meaning
Available (Tested)
Not Available (Not tested/not functional or both)
N/A Not supported by MCU 
MCU Group Liquid crystal waveform (waveform A or B) selectable Voltage Generator - Internal voltage boosting method, and external resistance division method Voltage Generator - Capacitor split method LCD blinking and display functions Source Clock support: Main Clock Oscillator Source Clock support: Sub Clock Oscillator
S124 N/A N/A N/A N/A N/A N/A
S128 N/A N/A N/A N/A N/A N/A
S1JA N/A N/A N/A N/A N/A N/A
S3A1
S3A3
S3A6
S3A7
S5D3 N/A N/A N/A N/A N/A N/A
S5D5 N/A N/A N/A N/A N/A N/A
S5D9 N/A N/A N/A N/A N/A N/A
S7G2 N/A N/A N/A N/A N/A N/A
MCU Group Source Clock support: Low speed Clock Oscillator Source Clock support: High speed Clock Oscillator Time slice modes – Static, 4 Time slice modes – 1, 2, 3, and 8 Bias method 2, 3, 4 Contrast adjustment
S124 N/A N/A N/A N/A N/A N/A
S128 N/A N/A N/A N/A N/A N/A
S1JA N/A N/A N/A N/A N/A N/A
S3A1
S3A3
S3A6
S3A7
S5D3 N/A N/A N/A N/A N/A N/A
S5D5 N/A N/A N/A N/A N/A N/A
S5D9 N/A N/A N/A N/A N/A N/A
S7G2 N/A N/A N/A N/A N/A N/A

SLCDC HAL Module APIs Overview

The Segment LCD Controller HAL module defines APIs for functions such as opening, writing, starting, modifying and closing. A complete list of the available APIs, an example API call and a short description of each can be found in the following table. A table of status return values follows the API summary table.

SLCDC HAL Module API Summary

Function Name Example API Call and Description
open g_slcdc.p_api->open(g_slcdc.p_ctrl, g_slcdc.p_cfg);
Open SLCD device.
write g_slcdc.p_api->write(g_slcdc.p_ctrl, start_segment, &data, segment_count);
Write data to SLCD segments. Specifies the initial display data. The data parameter is a pointer to an array of bytes consisting at least segment_count items, in which each byte is associated with one segment data register. When the number of time slices is static, 2, 3 or 4, the lower 4 bits of the data become an A-pattern area and the upper 4 bits become a B-pattern area. See slcdc_api_t::setdisplayArea for setting a display area.
modify g_slcdc.p_api->modify(g_slcdc.p_ctrl, segment, data_mask, data);
Rewrite data in the SLCD segment. Rewrites the LCD display data in 1-bit units. If a bit is not specified for rewriting, the value stored in the bit is held as it is. Specifies the data to rewrite.
start g_slcdc.p_api->start(g_slcdc.p_ctrl);
Enable display on the SLCD. Displays the specified data on the LCD. Before that data should be written to the segments.
stop g_slcdc.p_api->stop(g_slcdc.p_ctrl);
Disable display on the SLCD. Stops displaying data on the SLCD.
contrastIncrease g_slcdc.p_api->contrastIncrease(g_slcdc.p_ctrl);
Increase the display contrast. Increase by 1 unit. This function can be selected when the internal voltage boosting method is used for the drive voltage generator.
contrastDecrease g_slcdc.p_api->contrastDecrease(g_slcdc.p_ctrl);
Decrease the display contrast. Decrease by 1 unit. This function can be selected when the internal voltage boosting method is used for the drive voltage generator.
setdisplayArea g_slcdc.p_api->setdisplayArea(g_slcdc.p_ctrl, display_area);
Set LCD display area. This function sets a specified display area, A-pattern or B-pattern. This function can be used to set blink on where A-pattern and B-pattern area data will be alternately displayed. When using blinking, the RTC is required to operate before this function is executed. To configure the RTC, follow the steps below.
1. Open RTC
2. Set Periodic interrupt request, ½ second
3. Start RTC counter
4. Enable IRQ, RTC_EVENT_PERIODIC_IRQ
Refer to the User's Manual: Microcontrollers for the detailed procedure.
close g_slcdc.p_api->close(g_slcdc.p_ctrl);
Close display device.
versionGet g_slcdc.p_api->versionGet(&version);
Retrieve the API version using the version pointer.
Note
For more complete descriptions of operation and definitions for the function data structures, typedefs, defines, API data, API structures, and function variables, review the SSP User's Manual API References for the associated module.

Status Return Values

Name Description
SSP_SUCCESS Function successful.
SSP_ERR_ASSERTION Assertion error.
SSP_ERR_INVALID_ARGUMENT Invalid Argument.
SSP_ERR_HW_LOCKED SLCDC resource is locked.
SSP_ERR_NOT_OPEN Device is not opened or initialized.
SSP_ERR_UNSUPPORTED Unsupported operation.
SSP_ERR_NOT_ENABLED RTC not enabled for blink operation.
Note
Lower-level drivers may return common error codes. Refer to the SSP User's Manual API References for the associated module for a definition of all relevant status return values.

SLCDC HAL Module Operational Overview

This module uses the Segment LCD controller (SLCDC) to display data on a Segment LCD. The driver initializes the LCD for displaying data and configures the drive-voltage generator, display waveform, number of time slices and bias methods to drive the LCD. This module provides functions to display data to a specified set of segments, to modify existing segment data, to enable and disable display, to set the display area and to adjust the contrast. The contents displayed on the LCD can be changed by changing the contents of the LCD display data registers.

SLCDC HAL Module Important Operational Notes and Limitations

SLCDC HAL Module Operational Notes

  • This driver is a HAL driver and has no dependencies with the ThreadX RTOS. You can add the Segment LCD HAL module to a thread in the ThreadX RTOS if it is desirable.
  • To write to a sequence of segments, give the start segment number and number of segments to be written in the slcdc_api_t::write API.

SLCDC HAL Module Limitations

  • Refer to the most recent SSP Release Notes for any additional operational limitations for this module.

Including the SLCDC HAL Module in an Application

This section describes how to include the SLCDC HAL Module in an application using the SSP configurator.

Note
This section assumes you are familiar with creating a project, adding threads, adding a stack to a thread and configuring a block within the stack. If you are unfamiliar with any of these items, refer to the first few chapters of the SSP User's Manual to learn how to manage each of these important steps in creating SSP-based applications.

To add the Segment LCD Driver to an application, simply add it to a thread using the stacks selection sequence given in the following table. (The default name for the Segment LCD Driver is g_timer0. This name can be changed in the associated Properties window.)

SLCDC HAL Module Selection Sequence

Resource ISDE Tab Stacks Selection Sequence
g_slcdc0 Segment LCD Driver on r_slcdc Threads New Stack> Driver> Graphics> Segment LCD Driver on r_slcdc

When the Segment LCD Driver on r_slcdc is added to the thread stack as shown in the following figure, the configurator automatically adds any needed lower‑level modules. Any modules needing additional configuration information have the box text highlighted in Red. Modules with a Gray band are individual modules that stand alone. Modules with a Blue band are shared or common; they need only be added once and can be used by multiple stacks. Modules with a Pink band can require the selection of lower-level modules; these are either optional or recommended. (This is indicated in the block with the inclusion of this text.) If the addition of lower-level modules is required, the module description include Add in the text. Clicking on any Pink banded modules brings up the New icon and displays possible choices.

SLCDC_MS.png
SLCDC HAL Module Stack

Configuring the SLCDC HAL Module

The SLCDC HAL Module must be configured by the user for the desired operation. The available configuration settings and defaults for all the user-accessible properties are given in the properties tab within the SSP configurator and are shown in the following tables for easy reference. Only properties that can be changed without causing conflicts are available for modification. Other properties are locked and not available for changes and are identified with a lock icon for the locked property in the Properties window in the ISDE. This approach simplifies the configuration process and makes it much less error-prone than previous manual approaches to configuration. The available configuration settings and defaults for all the user-accessible properties are given in the Properties tab within the SSP Configurator and are shown in the following tables for easy reference.

Note
You may want to open your ISDE, create the module and explore the property settings in parallel with looking over the following configuration table settings. This will help orient you and can be a useful 'hands-on' approach to learning the ins and outs of developing with SSP.

Configuration Settings for the SLCDC HAL Module on r_slcdc

ISDE Property Value Description
Parameter Checking BSP, Enabled, Disabled

Default: BSP
Select if extra code will be added to check parameter values.
Name g_slcdc0 Module name.
Slcdc Clock Clock Loco, Clock Sosc, Clock Mosc, Clock Hoco

Default: Clock Hoco
SLCD clock source (LCDSCKSEL).
Slcdc Clock Divisor Clk Divisor Loco 4, Clk Divisor Loco 8, Clk Divisor Loco 16, Clk Divisor Loco 32, Clk Divisor Loco 64, Clk Divisor Loco 128, Clk Divior Loco 256, Clk Divisor Loco 512, Clk Divisor Loco 1024, Clk Divisor Hoco 256, Clk Divisor Hoco 512, Clk Divisor Hoco 1024, Clk Divisor Hoco 2048, Clk Divisor Hoco 4096, Clk Divisor Hoco 8192, Clk Divisor Hoco 16384, Clk Divisor Hoco 32768, Clk Divisor Hoco 65536, Clk Divisor Hoco 131072, Clk Divisor Hoco 262144, Clk Divisor Hoco 524288

Default: Clk Divisor Hoco 16384
LCD clock setting (LCDC0), clock divisor.
Bias Method Bias 2, Bias 3, Bias 4

Default: Bias 2
LCD display bias method select (LBAS bit).
Time Slice Static, Slice 2, Slice 3, Slice 4, Slice 8

Default: Static
Time slice of LCD display select (LDTY bit).
Wave Form Wave A, Wave B

Default: Wave A
LCD display waveform select (LWAVE bit).
Slcdc Drive Voltage Generator External resistance division, Internal voltage boosting, Capacitor split

Default: External resistance division
LCD Drive Voltage Generator Select (MDSTET bit).
Note
The example settings and defaults are for a project using the Synergy S7G2 MCU Group. Other MCUs may have different default values and available configuration settings.

SLCDC HAL Module Clock Configuration

Configure the SLCDC Hal module clock in the properties window of the g_slcdc driver. The operating clock of the SLCDC HAL Module is specified by the SLCDC Clock and SLCDC Clock Divisor settings in the Properties window. The Segment LCD HAL module-source clock can be configured as the Main (MOSC), HOCO (High-speed Clock Oscillator), LOCO (Low-speed Clock Oscillator) or Sub-clock (SOSC) using the ISDE configurator. For HOCO and LOCO settings, several clock divisors are available.

SLCDC HAL Module Pin Configuration

The SLCDC peripheral module uses pins on the MCU to communicate to external devices. I/O pins must be selected and configured as required by the external device. The following table illustrates the method for selecting the pins within the SSP configuration window and the subsequent table illustrates an example selection for the pins.

Note
For some peripherals, the operation mode selection determines what peripheral signals are available and what MCU pins are required.

Pin Selection for the SLCDC HAL Module on r_slcdc

Resource ISDE Tab Pin Selection Sequence
SLCDC Pins Select Peripherals> Graphics: SLCDC> SLCDC0
Note
The selection sequence assumes SLCDC0 is the desired hardware target for the driver.

Pin Configuration Settings for SLCDC HAL Module

Pin Configuration Property Value Description
Operation Mode Disabled, Custom, Static, 2x Slice, 3x Slice, 4x Slice, 8x Slice

Default: Custom
Select operation mode enable or disable.
CAPH None, P111

Default: None
Capacitor connection pin.
CAPL None, P112

Default: P112
Capacitor connection pin.
COM0:3 None, Pn

Default: P104:107
Common pins.
COM4:7 None, Pn

Default: None
Common pins.
VL1:4 None, Pn

Default: P100:103
Power supply pins.
SEG00:02,
SEG06:07,
SEG16:17,
SEG21:25,
SEG46:51
None, Pn

Default: None
Segment pins.
SEG03 None, P303

Default: P303
Segment pin.
SEG04:05 None, Pn

Default: P314:315
Segment pins.
SEG08 None, P902

Default: P902
Segment pin.
SEG09:15 None, Pn

Default: P312:306
Segment pins.
SEG18:19 None, Pn

Default: P808:809
Segment pins.
SEG20 None, P313

Default: P313
Segment pin.
SEG26:27 None, Pn

Default: P806:807
Segment pins.
SEG28:34 None, Pn

Default: P608:614
Segment pins.
SEG35:41 None, Pn

Default: P606:600
Segment pins.
SEG42:43 None, Pn

Default: P805:804
Segment pins.
SEG44:45 None, Pn

Default: P800:801
Segment pins.
Note
The example settings are for a project using the Synergy S7G2 MCU Group and the SK-S7G2 Kit. Other Synergy MCUs and Synergy Kits may have different available pin configuration settings.

Using the SLCDC HAL Module in an Application

The typical steps in using the SLCDC HAL module in an application are:

  1. Initialize the SLCD HAL module using the slcdc_api_t::open API.
  2. Write a sequence of segments using the slcdc_api_t::write API.
  3. Modify the content of the segment data using the slcdc_api_t::modify API if needed.
  4. Change the display area or blinking display using the slcdc_api_t::setdisplayArea API.
  5. Enable the display by using the slcdc_api_t::start API.
  6. Adjust contrast using the slcdc_api_t::contrastIncrease or slcdc_api_t::contrastDecrease APIs.
  7. Disable the display by using the slcdc_api_t::stop API.
  8. Close the driver using the slcdc_api_t::close API.

These common steps are illustrated in a typical operational flow diagram in the following figure:

SLCDC_TA.png
Flow Diagram of a Typical SLCDC HAL Module Application