SLAAEE9 November   2023

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Glass Segment LCD Basics
    1. 1.1 Driving a Segment LCD
    2. 1.2 LCD Mapping
  5. 2Hardware
    1. 2.1 Choosing Pins to Connect to LCD Module
  6. 3Software Implementation
    1. 3.1 Customizing the Software LCD Code
    2. 3.2 Software Flow
    3. 3.3 Integrating Software LCD Solution Within an Application
  7. 4Additional Resources

Software Flow

Figure 3-1 shows the software flow diagram for the two main pieces of code of this solution: the LCD_WriteCharacter function and the interrupt handler for the LCD_Update_Clock.

GUID-20231103-SS0I-35ZQ-FFSR-MDM0LXLR6DMK-low.svg Figure 3-1 Software Flow Diagram

The LCD_WriteCharacter() takes in index to the character map array (gNumberMap) that corresponds to the alpha-numeric character you want to display on the LCD, as well as an index to the segment map (gSegmentOffsetMap) that corresponds to the character position on the LCD. The function parses the character and writes it to the appropriate LCD memory table (gLCD_MemoryTable_Lower or gLCD_MemoryTable_Upper). Due to this structure, the LCD_WriteCharacter() can be called at any point of the application, and update the LCD memory table asynchronously to the LCD update clock.

The LCD_Update_Clock interrupt handler is the main driver of the SW LCD solution. It includes a state machine that replicates the waveform described in Figure 1-1 earlier, where each case represents one of the time instances shown, and the following actions are taken.

For even cases:

  • COMx-1 is placed in high-z sate
  • COMx is set low
  • All SEGy lines are set or cleared according to the LCD memory table

For odd cases:

  • COMx is set high
  • All SEGy lines are toggled