background image

Interfacing an LCD to the MC9S08LC60, Rev. 0

Example Application Using the DEMO9S08LC60

Freescale Semiconductor

18

4.2

Example Application Software Overview

This section provides an overview of the configuration of the example application demo. The overview 
reviews settings for:

ICG

SCI

LCD

These LCD drivers are a subset of the application. The application could be an energy meter or a toy.

The goal of this section is not to describe every function in detail. Instead, only select functions will be 
described. For example, a description will be provided for the implementation of a procedure for the 
mapping of the MCU LCD RAM to alphanumeric segment groups as described in the previous section. 

4.2.1

ICG Configuration

The ICG has four possible configurations, including the following three modes:

FLL bypassed, external clock (FBE) mode

FLL engaged, internal clock (FEI) mode

FLL engaged, external clock (FEE) mode

Both FBE and FEE use the on-board 32.768 kHz crystal on the DEMO9S08LC60. For these modes, the 
DEMO9S08LC60 CLK ENA jumper must be installed. For the lowest power mode, the FBE mode is 
recommended. If the use of the LCD in stop3 is desired, FBE mode is also recommended. If lower 
system/BOM (bill of materials) cost is the priority, the FEI mode should be used. Cpu.h defines variables 
to select the desired ICG clock mode. 

While the demo software is pre-configured to use the ICG FBE mode, the demo project can be modified 
so that the user can also operate the demo in FEI and FEE ICG modes. When using either FEI and FEE 
ICG modes, the demo uses a faster SCI baud setting (9600 bps). The code excerpt below from Cpu.h shows 
the ICG options built-in to the project. 

//=======================================================
//Select a clock mode
//=======================================================
//FBE = FLL ByPassed External Clock 
#define FBE_32KHZ 

1 /* 32 kHz crystal and 16 kHz fbus */

//FEE = FLL Enabled using External Clock
#define FEE_32K8BUS 

0 /* 32 kHz crystal and 8.39 MHz fbus */

#define FEE_32K16BUS 

0 /* 32 kHz crystal and 16.775 MHz fbus */

//FEI = FLL Enabled Internal Clock
#define FEI_8MBUS 

0 /* fbus 17.77/2 MHz; untrimmed */

Summary of Contents for MC9S08LC60

Page 1: ...8LC60 enters stop3 sleep mode Figure 1 provides a block diagram of the MC9S08LC60 In addition to the built in LCD driver the MC9S08LC60 has notable peripherals such as a 12 bit ADC and dual Flash arrays for EEPROM emulation as shown in the block diagram 1 MC9S08LC60 Introduction 1 1 1 Type of LCD Glass Compatible with MC9S08LC60 2 1 2 Number of Segments and Using Segments in LCD 3 1 3 LCD Glass Sp...

Page 2: ...and a quickstart for the demo All code for the demo is provided in the file AN3280SW1 zip which can be found on the Freescale web page freescale com 1 1 Type of LCD Glass Compatible with MC9S08LC60 Two common LCD types are TN twisted nematics and STN super twisted nematics TN type LCD glass is very cost effective and is compatible with multiplexing LCD drivers using fewer than 16 backplanes The mu...

Page 3: ...e relevant 1 2 Number of Segments and Using Segments in LCD Depending on package and LCD configuration the MC9S08LC60 can support up to 160 segments The number of segments is equal to the number of backplanes times the number of frontplanes With multiplex LCD drivers like the MC9S08LC60 each frontplane pin can be connected to as many segments as there are backplanes With up to 160 segments the MC9...

Page 4: ...erating temperature Varies 2 LCD Module Overview 2 1 LCD Module Power Supply Configuration The LCD module provides several configurations for its power supply The LCD module can be powered via VDD or alternatively by an external LCD power supply connected to the VLCD pin the VLCD voltage range is 1 4 to 1 8 V The LCD module power supply configuration is determined by the VSUPPLY 1 0 bit field A bl...

Page 5: ...h the LCD module voltage supply switch VSUPPLY 1 0 configured to generate VLL2 from VDD 2 1 2 Configuration Options for 5 V LCD Glass When driving 5 V LCD glass the following configurations are available Power LCD module via VLCD where VLCD is nominally 1 67 volts with the LCD module configured for tripler mode Power the LCD module via VDD where VDD is nominally 3 3 volts with the LCD module volta...

Page 6: ...ctionality is available in stop3 mode The LCDDRMS bit in the LCDCMD register is used in conjunction with the LCDRAM registers to provide blinking control for individual segments If the LCDDRMS bit is cleared the LCDRAM registers control the display on off state for segments on the LCD display If LCDDRMS bit is set the LCDRAM registers control the blink enable on off state for the corresponding seg...

Page 7: ...B to detail the requirements for interfacing an LCD glass to the MC9S08LC60 Figure 4 shows the top layer silk screen of the DEMO9S08LC60 with the LCD glass panel The LCD glass panel is shown with all LCD segments turned on This section will review the LCD glass design in detail and discuss the interfacing of the LCD module to the LCD glass via hardware and software Figure 4 DEMO9S08LC60 ...

Page 8: ...groups are labeled 1 to 9 starting from the leftmost character position The LCD panel is manufactured by S Tek Displays part number GD3980P Figure 5 Custom LCD from S Tek Displays The LCD panel s segment layout is not the only important aspect of its design Other LCD glass specifications such as those mentioned in Section 1 1 also dictate how the LCD glass must be driven by an LCD driver for optim...

Page 9: ... LCD to the MC9S08LC60 Rev 0 Freescale Semiconductor 9 Figure 6 shows all 160 segments labeled individually This information is provided by the LCD manufacturer See the appendix for the full GD3980P specification for S Tek Displays Figure 6 Segment Labels ...

Page 10: ... DT9 V1 3 COM3 25 V2 AM PM OM 4 COM4 26 KWh Amps Volts Program 5 1H 1F 1E 1N 27 VOL V3 V4 V5 6 1A 1J 1G 1M 28 T4 T3 T2 T1 7 1K 1L 1D TIME 29 6B 6C DT6 T 8 1B 1C DT1 DT 30 6K 6L 6D K3 9 2H 2F 2E 2N 31 6A 6J 6G 6M 10 2A 2J 2G 2M 32 6H 6F 6E 6N 11 2K 2L 2D DATE 33 5B 5C COL2 DT5 12 2B 2C COL1 DT2 34 5K 5L 5D VOLUME 13 7H 7F 7E 7N 35 5L 5J 5G 5M 14 7A 7J 7G 7M 36 5H 5F 5E 5N 15 7K 7L 7D P 37 4B 4C DT4...

Page 11: ...play segments and the MCU LCD RAM registers can be established The mapping is determined by both the MCU to LCD pin connections Figure 7 and the LCD pin out specification Table 3 Each bit in the MCU RAM registers is mapped to an individual segment on the LCD glass Table 4 shows the MCU LCD RAM registers where the individual bits are labelled FPxBPy Figure 7 shows both the BPy and the FPx relations...

Page 12: ...2 FP2BP1 FP2BP0 0x184A LCDRAM2 FP5BP3 FP5BP2 FP5BP1 FP5BP0 FP4BP3 FP4BP2 FP4BP1 FP4BP0 0x184B LCDRAM3 FP7BP3 FP7BP2 FP7BP1 FP7BP0 FP6BP3 FP6BP2 FP6BP1 FP6BP0 0x184C LCDRAM4 FP9BP3 FP9BP2 FP9BP1 FP9BP0 FP8BP3 FP8BP2 FP8BP1 FP8BP0 0x184D LCDRAM5 FP11BP3 FP11BP2 FP11BP1 FP11BP0 FP10BP3 FP10BP2 FP10BP1 FP10BP0 0x184E LCDRAM6 FP13BP3 FP13BP2 FP13BP1 FP13BP0 FP12BP3 FP12BP2 FP12BP1 FP12BP0 0x184F LCDRAM...

Page 13: ...6 the leftmost 13 segment display group is the first position With a 13 segment display layout each alphanumeric character will require 13 bits of MCU LCD RAM Figure 8 GP3980P Custom 13 Segment Display Layout Pattern 3 3 2 Alphanumeric Segment Group MCU LCD RAM Mapping This section gives an example of the mapping of an alphanumeric segment group for the leftmost 13 segment display position 1 on th...

Page 14: ...h the 13 segment display For these locations the bit value is irrelevant In this case for alphanumeric characters in character position 1 these are the bits for the labels TIME DT and DT1 Table 6 provides a more detailed tabular form of the decoding from MCU pins to LCD segments Table 5 LCD RAM Values for the Leftmost GD3890P Alphanumeric Character to Display an M LCDRAM0 FP1BP3 1M FP1BP2 1G FP1BP...

Page 15: ...sed for alphanumeric groups LCDRAM20 is not used at all because FP40 is not used in 1 4 duty mode In 1 4 duty mode the multiplexed BP3 FP40 pin is configured as BP3 Table 6 Detailed Alphanumeric Segment Mapping MCU Pin Function MCU Pin in 80 Pin Package MCU Pin in 64 Pin Package LCD Pin LCD Segment MCU LCD RAM Bit COM1 BP0 COM2 BP1 COM3 BP2 COM4 BP3 FP0 7 6 5 1H FP0BP0 1F FP0BP1 1E FP0BP2 1N FP0BP...

Page 16: ... MC9S08LC60 s SCI0 using a PC and a COM terminal program such as Hyperterminal or Tera Term Other features of the demo are Demonstrates the usage of an MC9S08LC60 with a 32 768 kHz external crystal clock source Demonstrates configuration of the ICG Demonstrates the reception of data via SCI0 Demonstrates configuration of the SCI0 baud rate Demonstrates the usage of the LCD modules Demonstrates the...

Page 17: ...ving similar functions have slightly different source code implementations The SofTech Microsystems demo source code is provided on a CD in the DEMO9S08LC60 kit 4 1 DEMO9S08LCD60 Overview and Configuration The DEMO9S08LC60 see Figure 4 is a full featured customer evaluation PCB with a built in USB to BDM programmer Besides providing a programming interface the USB cable can also be used to power t...

Page 18: ...ock FEE mode Both FBE and FEE use the on board 32 768 kHz crystal on the DEMO9S08LC60 For these modes the DEMO9S08LC60 CLK ENA jumper must be installed For the lowest power mode the FBE mode is recommended If the use of the LCD in stop3 is desired FBE mode is also recommended If lower system BOM bill of materials cost is the priority the FEI mode should be used Cpu h defines variables to select th...

Page 19: ...ely equal to the bus clock 16 desired baud rate In the demo application SCIDIVIDER can be configured in sci h In the case of a 32 768 kHz crystal in FBE mode SCIDIVIDER is selected in sci h such that the baud rate is 110 bps 4 2 3 LCD Configuration An LCD driver can be developed using a variety of approaches LCD drivers provide the ability to initialize the LCD module and write to the display Beca...

Page 20: ... parameters are compile time decisions Each of the functions called by LCD_init can be found in lcddrv c void LCD_init Configure clock source CONFIG_CLKSOURCE power supply configuration SET_CONFIG_VSUPPLY Configure operation in stop wait SET_LCDCR1_REG Configure frame frequncy SET_LCD_FRAME_FREQU Configure blink rate CONFIG_BLINKING 2 Hz OFF Enable Frontplanes ENABLE_FP Enable LCD ENABLE_LCD ON Ma...

Page 21: ...en calling these functions with lcdramm set to SEGBLINKEN the LCDRAM 20 0 bits control the blink enable on off function void SET_LOGO char lcdramm char k void SET_VOL char lcdramm char v byte numbars void SET_BATT char lcdramm char t byte numbars void SET_POWERSAVE char lcdramm char p void SET_TIMESEGS byte lcdramm byte am byte pm byte k3 void SET_TEMPSEGS byte lcdramm byte k1 byte k2 char col4 vo...

Page 22: ...shown below illustrates the usage of the lookup table and the manipulation of the proper LCDRAM registers to display the correct alphanumeric When a new value is to be written to the LCDRAM registers it must be ORed with the previous value This is necessary because there are other segments in the LCDRAM register that are not part of the 13 segment display and their values must be preserved see Fig...

Page 23: ... _ 0x00 0x4 4 2 3 2 3 Scrolling a String Across the LCD Display Scroll_String The example application provides the Scroll_String tU08 string byte local_length function to scroll an alphanumeric character string across the LCD display The complete source code for Scroll_String can be found in lcddrv c The Scroll_String function accepts a string argument of length n manipulates it and calls output_s...

Page 24: ...ation is very simple providing the following functionality Initialize ports ICG SCI LCD Initialize interrupts Display the default message Provide application loop Below is the source code for the program loop in main Program LOOP while 1 Check incoming data result AS1_RecvChar c if result ERR_OK sci_input inputcounter c toupper c inputcounter inputcounter 1 if c r sci_input inputcounter 1 0 string...

Page 25: ... configured to drive the LCD panel at 3 Volts with a 1 4 duty cycle and a frame frequency of 64 Hz The following instructions provide a walkthrough of the demo operation 1 Unpack the DEMO9S08LC60 and place jumpers as described in Table 8 2 Connect a serial cable from a PC to the DEMO9S08LC60 3 Connect an USB cable from a PC to the DEMO9S08LC60 4 Unzip the AN3280SW1 zip file 5 Start Code Warrior an...

Page 26: ...3280SW1 zip includes a pre configured HyperTerminal session file AN3280_Term ht that can be used for this part of the demo 12 Type an alphanumeric character sequence in the terminal program and then press the Enter key a The program will not change the display until the Enter key is pressed b You can press the Enter key without entering alphanumeric c Every time the Enter key is pressed the LCD ba...

Page 27: ...Interfacing an LCD to the MC9S08LC60 Rev 0 Freescale Semiconductor 27 THIS PAGE IS INTENTIONALLY BLANK ...

Page 28: ...ly disclaims any and all liability including without limitation consequential or incidental damages Typical parameters that may be provided in Freescale Semiconductor data sheets and or specifications can and do vary in different applications and actual performance may vary over time All operating parameters including Typicals must be validated for each customer application by customer s technical...

Reviews: