The Segment LCD Driver provides an API to configure and operate the MXLCD hardware block.
The MXLCD block can be flexibly configured to drive a variety of LCD glass at different voltage levels with multiplex ratios.
Features:
The Segment LCD Driver can be used either as a standalone library to manage the MXLCD hardware or as a part of the more complex software solution delivered within ModusToolbox: the Device Configurator SegLCD personality and the SegLCD Configurator tools.
The SegLCD solution provides an easy method to configure an MXLCD block to drive your standard or custom LCD glass:
The SegLCD solution includes:
To start working with an LCD, first initialize the MXLCD block, then initialize the frame buffer, and then enable the block:
Contrast vs. Frame Rate (cy_stc_seglcd_config_t::contrast vs. cy_stc_seglcd_config_t::frRate)
Some combinations of a frame rate and input frequency can restrict the valid contrast range because of the limited dividers size (for Low Speed mode - 8 bit, and for High Speed mode - 16 bit). For small values of contrast at small frame rates, the required divider values may be beyond permissible limits of the dividers size. For large High Speed clock frequencies, certain ratios between the contrast and frame rate cannot be achieved due to the limited divider size. The Cy_SegLCD_Init function automatically restricts such incorrect combinations (returns CY_SEGLCD_BAD_PARAM).
Speed Mode Switching (cy_stc_seglcd_config_t::speed)
The High Speed and Low Speed generators mostly duplicate each other, except that for MXLCD_ver1, the High Speed version has larger frequency dividers to generate the frame and sub-frame periods. This is because the clock of the High Speed block typically has a frequency 30-100 times bigger than the 32 KHz clock fed to the Low Speed block. For MXLCD_ver2, both High Speed and Low Speed generators have similar 16-bit dividers, because a possibility exists to source a Low Speed generator with a Medium Frequency clock (see Medium Frequency Domain Clock) that may be much higher than 32 KHz ILO. Switching between High Speed and Low Speed modes via the Cy_SegLCD_Init function causes the dividers to reconfigure. Under possible restrictions related to certain ratios between contrast and frame rates (see Contrast vs. Frame Rate section above), switching between High Speed and the Low Speed modes via the Cy_SegLCD_Init function may set new dividers values that don’t give the same contrast value.
Driving Modes (cy_stc_seglcd_config_t::drive)
SegLCD supports the following operating modes:
Conventional Waveforms (cy_stc_seglcd_config_t::wave)
Conventional LCD drivers apply waveforms to COM and SEG electrodes generated by switching between multiple different voltages. The following terms are used to define these waveforms:
The following figures show the conventional waveforms for COM and SEG electrodes for the 1/3rd bias and 1/4th duty. Only COM0/COM1 and SEG0/SEG1 are drawn. Conventional Type-A Waveform Example:
Conventional Type-B Waveform Example:
The generalized waveforms for individual sub-frames for any duty and bias are illustrated in the following figure. Note that these use 6 different voltages at most(including VSS and VDRV). Conventional Waveforms - Generalized:
The effective RMS voltage for on and off segments can be calculated using these waveforms:
The resulting Discrimination Ratio (D) for various bias and duty combinations is illustrated in the following table. The bias choice (B) for each duty (M) with the highest possible value for D is colored green:
Digital Correlation (CY_SEGLCD_CORRELATION)
The principles of operation are illustrated by the example waveforms shown in the following figures. Digital Correlation Example – Type-A:
Digital Correlation Example – Type-B:
As illustrated, instead of generating bias voltages between the rails, this approach takes advantage of the LCD displays characteristic: the LCD segments' on-ness and off-ness degree is determined by the RMS voltage across the segments. In this approach, the correlation coefficient between any given pair of COM and SEG signals determines whether the corresponding LCD segment is On or Off. Thus, by doubling the base drive frequency of the COM signals in their inactive sub-frame intervals, the phase relationship of the COM and SEG drive signals can be varied to turn segments on and off – rather than varying the DC levels of the signals as is used in the conventional approaches.
PWM Drive (CY_SEGLCD_PWM)
This approach duplicates the multi-voltage drive signals of the conventional method with bias B using a PWM output signal together with the intrinsic resistance and capacitance of the LCD display to create a simple PWM DAC. This is illustrated in the following figure:
To drive a low-capacitance display with an acceptable ripple and rise/fall time, using a 32-kHz PWM an additional external series resistance of 100 k - 1 M ohm is required. External Resistors are not required for PWM frequencies of greater than ~1 MHz. The exact frequency depends on the display capacitance, the internal ITO resistance of the ITO routing traces, and the drive impedance of the I/O pins. The PWM method works for any bias value (B). NOTE As B gets higher, a higher PWM step frequency is required to maintain the same PWM output frequency (the RC response of the LCD depends on the PWM output frequency, NOT the step frequency). The PWM approach may also be used to drive a 1/2-bias display. This has the advantage that PWM is only required on the COM signals, as SEG signals of a 1/2-bias display use only logic levels. Therefore, PWM 1/2-bias can be supported at 32 kHz using just four external resistors. The power consumption of the approach (even for 1/2 bias) is substantially higher than that of other methods. Therefore, it is recommended power-sensitive customers use Digital Correlation drive in Deep Sleep mode, and change to PWM mode to gain the advantage of better contrast/viewing angle on TN displays in Active or Sleep mode.
PWM1/2 LCD drive waveform:
PWM1/3 LCD drive waveform:
Digital Contrast Control
In all modes, digital contrast control is available using the duty cycle/dead time method illustrated in the following figure:
This illustration shows the principle for 1/3 bias and 1/4 duty implementation, but the general approach of reducing contrast by reducing the percentage of time the glass is driven can be generalized and applied to any drive method. In all cases, during the dead time, all COM and SEG signals are set to a logic "1" state.
When the block is configured, for further work with display, a display structure is needed:
And now you can write multi-digit decimal and hexadecimal numbers and strings onto the initiated 7-segment display:
after which the next image on the glass appears:
Or even manage separate LCD pixels:
after which the next image on the glass appears:
Also, you can customize basic fonts, for example:
And now you can write characters and strings on a standard 7-segment display:
after which the next image on the glass appears:
Also, you can customize or create your own displays, for example:
And also different fonts for them:
And now use all that together:
Refer to the technical reference manual (TRM) and the device datasheet.
| MISRA Rule | Rule Class (Required/Advisory) | Rule Description | Description of Deviation(s) |
|---|---|---|---|
| 10.3 | R | The value of a complex expression of integer type shall only be cast to a type of the same signedness that is no wider than the underlying type of the expression. | The value got from the bitfield physically cannot exceed the enumeration that describes this bitfield. So, the code is safe by design. |
| 11.4 | A | A cast should not be performed between a pointer to object type and a different pointer to object type. | This is a fix for the GCC compiler warning. |
| 14.1 | R | There shall be no unreachable code. | This is the HOBTO parameter reading for future features support. |
| Version | Changes | Reason for Change |
|---|---|---|
| 1.0 | Initial version |
API Reference | |
| Macros | |
| Functions | |
| Data Structures | |
| Global Data | |
| Enumerated Types | |