MCUs Simplify Touch Sense and Segment LCD-Based User-Interface Designs

By Warren Miller

Contributed By Hearst Electronic Products

Many MCU-based products use touch and a simple LCD output to implement the user interface design for consumer, industrial, and appliance applications. Examples of these devices are all around us: thermostats, alarms/clocks, heart-rate monitors, glucose monitors, calculators, electronic toys, security systems, multi-meters, microwaves, and washer/dryers, among others. Modern MCUs incorporate dedicated hardware features to simplify the implementation of these types of designs, including touch-sensor interfaces and segment-oriented LCD controllers.

To help engineers implement user interfaces based on these features vendors also offer an extensive ecosystem of software functions, software libraries, reference designs, targeted development tools, and development boards. This article provides an overview of some of the most important hardware features you need to implement touch sensing (both resistive and capacitive touch) along with segment-based LCD control. Examples of some key elements from the support ecosystem are also described to help in selecting the best solution for a specific user-interface design.

Segment LCD Control

MCUs are used in just about every piece of equipment that drives a segment-oriented LCD display, due to their low-operating power and programming flexibility. Even MCUs with 8-bit CPUs have the needed computation power and general-purpose interfaces required by many designs. The Freescale MC9S08LC60 adds some special purpose features that further simplify the implementation of segment-based LCD user interfaces. A quick overview of some of these key LCD controller features is a good baseline for evaluating and comparing similar features in other devices.

Perhaps the two most important parameters when implementing segment-based LCD controller functions are the type of LCD panels supported and the number of segments that can be driven. Some LCD panels require either 3 V or 5 V, and an MCU that can drive either voltage level, like the MC9S08LC60, provides additional flexibility. The number of segments that can be driven and the organizations supported is also an area where flexibility is required. The MCS08LC60 can support up to 4 backplanes (primary selection signals) and up to 41 frontplanes (segment selection signals). The total number of segments is the product of the number of backplanes and the number of frontplanes. Note that the potential number of characters depends on the number of segments per character as well as the number of segments supported. A useful table, like the one shown in Figure 1 for the MC9S08LC60, can be used to identify the various combinations supported. Notice that the number of pins available on the package also impacts the total number of segments, and thus the number of potential characters.

Image of display options for Freescale’s MC9S08LC60LK

Figure 1: Display options for Freescale’s MC9S08LC60LK (Courtesy of Freescale).

Once the type of LCD panel and the number of segments/characters are identified, some of the other key features of the LCD controller need to be explored. One useful feature in space-constrained designs is the inclusion of the LCD drivers on the MCU itself. This eliminates the need for an external driver and associated power supply circuitry. The MC9S08LC60 has an on-chip charge pump (to create an output voltage either double or triple the reference voltage) to generate the 3 V or 5 V supply voltage for the LCD panel. Inclusion of the charge pump on-chip also simplifies the generation of the LCD module waveform for increased power efficiency. An internal ADC is also available to monitor the LCD power level to adjust contrast via software for further power efficiency improvements.

When power efficiency is a critical requirement it may be possible to even operate the LCD while the MCU is in a low-power state. For example, the MC9S08LC60 can generate LCD waveforms even while the MCU is in the Wait or Stop3 low-power states. The contents of the on-chip dedicated LCD SRAM will be displayed on the LCD autonomously, without CPU intervention, while in these low-power states. Flexible LCD frame frequency and duty cycle settings can also be helpful in reducing LCD-related power consumption.

In addition to providing advanced hardware features, most suppliers provide advanced tool, development kits, and reference designs to simplify the implementation of simple user interfaces. For example, Texas Instruments provides a range of kits and reference designs for targeted applications using the TI MSP430 family. A reference design and eval module targeting the TI MSP430F6736 is available for smart-metering applications, and it provides an excellent starting point for a variety of segment-oriented metering designs. A picture of the board and the associated block diagram for the design is shown in Figure 2.

Image of Texas Instruments MSP430F6736 smart-meter reference design

Figure 2: Smart-meter reference design with segment-LCD interface (Courtesy of Texas Instruments).

The LCD controller featured on the TI MSP430F6736 can drive up to 320 segments depending on the number of pins available on the device. The types of LCDs supported include Static- and Multiplexed-style devices. The Multiplexed style uses up to 8 common signals to enable a set of up to 40 individual segment controls. In the above figure each of the six 7-segment numerals could be enabled with different common signals to simplify the display of numeric results. The remaining segments (kWh, kW, etc.) could be selected using the two remaining common signals, and shared based on when they are displayed. Some thought in planning segment layout can save a significant amount of data formatting and translation. Ideally, little processing would be required for LCD control so the CPU can remain in a low-power mode as much as possible.

The TI MSP430F6736 includes a variety of features to automate LCD control, including automatic signal generation (so the CPU need not be involved in low-level display operations), configurable frame frequency, automatic segment blink generation using a separate blink memory (on static, 2 to 4 mux LCDs), an integrated charge pump and fractional bias control settings for 1/3, 1/2, and 2/3 of the VLCD setting. Four interrupt sources are available to simplify updates to the display memory to avoid changes during display cycles. Example routines for setting interrupts are included in the data sheet and show cycle by cycle latencies to help you craft the most efficient interrupt handlers.

TI provides a wealth of example code with the smart-meter reference design and includes a prebuilt project, using the IAR Compiler. A walk-through of the build process is included so no previous experience with the IAR Compiler is required to benefit from building the example design and seeing the demonstration. Complete schematics are also included to make it easy to leverage already implemented and tested board design and layout.

Touch Interfaces

Using segment LCDs to display information to the user is an excellent output device, but most user interfaces also require user input. Touch interfaces offer one of the most intuitive styles of input and are typically much more robust than mechanical switches or indicators. Manufacturers are adding features to MCUs that make implementing touch interfaces intuitive as well. The Silicon Labs EFM32WG990F256 has some advanced features targeted at resistive touch interfaces.

The Low-Energy Sensor Interface (LESENSE) available on the Silicon Labs EMF32WG990F256 works in conjunction with other peripherals to perform many autonomous measurements using a configurable sensor. LESENSE uses the on-chip analog comparators for measurement of sensor signals together with the DAC to generate accurate reference voltages or perform sensor excitation. The LESENSE contains its own sequencer, count, and compare block, and a RAM block used for configuration and result storage. The sequencer handles interaction with other peripherals as well as timing of sensor measurements. The count-and-compare block is used to count pulses from analog compare outputs before comparing with a configurable threshold. To autonomously analyze sensor results, the LESENSE decoder can define a programmable state machine with up to 16 states, and programmable actions upon state transitions. This allows the decoder to implement a wide range of decoding schemes, for instance quadrature decoding. The dedicated RAM block is used for storage of configuration and measurement results, supporting a relatively large result buffer enabling the chip to remain in a low energy mode for long periods of time while collecting sensor data. LESENSE can operate in multiple low-power modes and can wake up the CPU on configurable events.

The theory of operation of the LESENSE sequencer is illustrated in Figure 3. The basic resistive sense method is to simply measure the voltage across a variable resistor, one with a resistance that varies according to an environmental factor, such as temperature, light, or mechanical position. Touch sensors with variable resistors simply change the resistance based on the force (or lack of it) on a touch pad. (Some of the most complex touch interfaces can also position the location of the touch based on readings from multiple sensors, but the theory is the same as that for a single on/off switch). A single-pin version of a resistive sense interface is shown at the top left of Figure 3.

A capacitor is placed at the output of the sense pin, in parallel with the resistive sensor “S”. During the excite phase a voltage is placed on the output, charging the capacitor. The charge stays on the capacitor, and then the pin is switched to the measure mode. If the sensor is active (and the resistance of the sensor is thus reduced), the voltage discharges more quickly, as seen in the diagram on the bottom left side of Figure 3. If the sensor is inactive (and the sensor resistance is larger), the voltage level discharges more slowly. The voltage measurement on the output pin can be timed (after some calibration) such that the sample will indicate if the sensor has been touched. In the configuration on the top right side of Figure 3 two pins are used. The LES_ALTEXn pin is used to excite the sensor and the ACMPn pin is used to measure the voltage over the resistive divider. The resulting measurement will indicate if the sensor is in the high- or low-resistance state to determine if the sensor has been touched.

Diagram of Silicon Labs EFM32WG990F256

Figure 3: Resistive touch sense using Silicon Labs EFM32WG990F256 (Courtesy of Silicon Labs).

The LESENSE peripheral can run autonomously from the rest of the CPU using very low power. The CPU can be “screened” from sensor events that do not need higher level response so that a minimum of energy is expended managing the interface. The dedicated SRAM can even buffer a large number of readings so that the CPU can wait in a low-power state until enough samples are available for bulk processing. The EFM32WG-DK3850 development kit includes a wide variety of example routines that can be used as starting points for a custom interface design.

Atmel provides a wide range of MCUs that are “touch-ready” (such as the ATSAM3U4CA-AU-ND) and have not only extensive hardware features to support capacitive touch but can be combined with the powerful QTouch library¹ to quickly implement touch interfaces using high-level constructs. Designers can embed capacitive-touch buttons, sliders, and wheel functionality using a common API over a wide range of Atmel MCUs. Capacitive touch is commonly implemented using a technique shown in Figure 4. As illustrated on the left side of the figure, the capacitance varies based on the amount the overlay is depressed towards the sensor. The resulting signal change, illustrated on the right side of the figure, can be measured to determine if the sensor is being touched. Using more complex measurements it is possible to determine motions for sliders, wheels and even movement in two dimensions (for a touchpad or touchscreen).

Diagram of Atmel QTouch technology

Figure 4: Capacitive touch implementation using Atmel QTouch technology (Courtesy of Atmel).

The Atmel QTouch Library provides key high-level functions for initializing, configuring, calibrating, and measuring capacitive touch sensors as illustrated in the list of API calls available in the library. The typical call sequence for a sensor is shown on the right side of Figure 5. Note that multiple sensors may be initialized and then measured within a single sensor loop. The library approach to implementing common elements, like touch interfaces, is a powerful one, providing dramatic productivity increases and something we can expect to see for other common interfaces where the low-level hardware details can be easily “hidden” from the user.

Atmel also provides a Product Training Module entitled “Touch Solutions Overview” to help engineers in their design efforts.

Image of Atmel QTouch API examples

Figure 5: Atmel QTouch API examples and typical call sequence.


Segment-oriented LCDs and touch interfaces are found in many MCU designs. Manufacturers are providing the features, development systems, reference designs and high-level software to make it as easy as possible to include these capabilities in your next design. For more information on the MCUs and reference designs described in this article, use the links provided to access product pages and training modules available on the Digi-Key website.

  1. Atmel QTouch library.
Electronic Products Logo

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Corporation or official policies of Digi-Key Corporation.