Abstract: This application note describes how to use the LCD simulator on the MAX-IDE and IAR Embedded Workbench, and explains how to create the LCD memory map and LCD display panel. This article assumes that the reader knows the MAXQ20 core, and is aware of the MAX-IDE and IAR Embedded Workbench. By the end of this application note the user will understand the workings of the LCD simulator in both development environments.
The LCD simulator needs two inputs:
Figure 1. LCD simulator GUI.
Table 1. Max-Ide_Lcd2MuxMode.asm Simulates the LCD Working in 1/2 Mux Mode in the MAX-IDE Environment
The above source code is available for download.
Table 2. IAR_Lcd2MuxMode.asm Simulates the LCD Working in 1/2 Mux Mode in the IAR Embedded Workbench
The above source code is available for download.
[LCDConfigFiles]
ConfigFile = config\lcd_config.xml
PinConfigFile = config\lcd_pin_config.xml
The user can override these files using the File→Open option of the GUI.
Figure 2. MAXQ2000 64-pin LCD panel.
After executing
Figure 3. MAXQ2000 64-pin LCD panel display changes with DPE = 1.
The difference, you will notice, is that COM0:SEG2, COM0:SEG3, COM0:SEG6, and COM0:SEG7 change color from black to red which indicates that the LCDs are sourced.
With EIE0.7 enabled (SEG31 multiplexed with INT7), the GUI will look like:
Figure 4. MAXQ2000 64-pin LCD panel with SEG multiplexed with INT.
Compare Figure 2 with Figure 4. COM0:SEG31 and COM1:SEG31 are not sourced as LCD segments.
Note: The User can design/modify the LCD display panel and MAXQ pinout input of the LCD simulator. The XML input file can be opened in any editor and XML tag names used are self-explanatory.
Introduction
The LCD simulator was developed on a Windows? platform with a GUI that simulates the digital behavior, but not the analog behavior, of the LCD controller. Readers can review application notes 3905, "MAX-IDE Simulator User's Guide for the MAXQ Microcontrollers," and 3378, "Getting started with the IAR Compiler and the MAXQ2000 Evaluation Kit" for information on working with MAX-IDE and IAR.Overview
The LCD simulator simulates the digital properties of the LCD controller, including: static, 1/2 mux, 1/3 mux, and 1/4 mux display modes; enabling/disabling LCD operation; and updating the LCD display with the display memory patterns. The LCD simulator ignores analog property changes, including: LCD drive voltage changes, display contrast adjustment, frame frequency effect.The LCD simulator needs two inputs:
- LCD segment configuration for static, 1/2, 1/3 and 1/4 display modes
- LCD pin configuration for static, 1/2, 1/3 and 1/4 display memory
Development Environment Settings for the LCD Simulator
The LCD simulator can be used on two environments, the MAX-IDE and the IAR Embedded Workbench.- MAX-IDE Settings
Some MAXQ? devices are configured and installed during the MAX-IDE installation. You can get the list of those devices from the Device→Options menu. Among these devices, the MAXQ2000 and MAXQ3210 have an LCD controller peripheral. Follow the steps below to create the project for simulation.- a. Create a Project. This procedure is explained in application note 3905 (see above) on the MAX-IDE simulator.
b. Add a file that tests the functionality of LCD controller. The file code is shown in Table 1.
c. Select Device→MAXQ2000→OK.
d. Under the Device menu, click on LCD Simulator and the LCD GUI will be displayed, as seen in Figure 1. - IAR IDE Settings
Some MAXQ devices' DDF (Device Description File), SFR, and ROM files are installed under the $TOOLKIT_DIR$\config directory during IAR Embedded Workbench installation. Follow the steps below to create the project used for simulation.- a. Create a project. This procedure is explained in the application note 3378 (see above) on the IAR compiler.
b. Add a file that tests the functionality of the LCD controller. The code is shown in Table 2.
c. Open Project→Options and go to the C Spy Debugger panel.
d. Select Device Simulator from the options shown.
e. Select the ddf file of the device to be simulated. In this example the file is maxq200x.ddf under $TOOLKIT_DIR$\config.
f. If the program is assembly, uncheck the "Run to main" option and Check XLINK→Include→Ignore C STARTUP in the library.
g. Select the utility ROM routine (.hex) of the device to be simulated, i.e., maxq200x.hex
h. Press OK.
i. Press Debug to debug the program.
j. Peripherals simulated can be seen under the View Menu option.
k. Select the LCD peripheral and the LCD GUI will be displayed as in Figure 1.
Figure 1. LCD simulator GUI.
Table 1. Max-Ide_Lcd2MuxMode.asm Simulates the LCD Working in 1/2 Mux Mode in the MAX-IDE Environment
The above source code is available for download.
Table 2. IAR_Lcd2MuxMode.asm Simulates the LCD Working in 1/2 Mux Mode in the IAR Embedded Workbench
The above source code is available for download.
Working with the LCD Simulator
As mentioned above, the LCD simulator depends on two XML input files:- Segment Configuration File
- Pin Configuration File
- Segment Configuration File
This file defines the type of the LCD display panel as either 7-segment or alphanumeric. The user can design the LCD display type by editing the XML file. The file details each segment as line or dot or any other shape (all multiples of a line) for static, 1/2 mux, 1/3 mux, and 1/4 mux. Without this input file, the LCD simulator will not update the GUI. - Pin Configuration File
Each MAXQ controller with a LCD peripheral comes in different pin configuration that assigns a different pin number for static, 1/2 mux, 1/3 mux, and 1/4 mux. Also some segment pins are multiplexed with two different functions:- a. I/O function
b. External interrupt, with I/O having the low priority and external interrupt having the higher priority.
[LCDConfigFiles]
ConfigFile = config\lcd_config.xml
PinConfigFile = config\lcd_pin_config.xml
The user can override these files using the File→Open option of the GUI.
LCD Registers and Their Simulation
- LCD Register Adjust (LCRA): Selects one of the display modes: static, 1/2 mux, 1/3 mux, and 1/4 mux. Changes to this register will be reflected on the status bar of the LCD GUI.
- LCD Configuration Register (LCFG): Each bit setting and the GUI status is described below:
Bit Settings GUI Changes DPE = 1 Display: ON DPE = 0 Display: OFF OPM = 1 OPM: Normal OPM = 0 OPM: Suspend
- LCDDx Registers: LCDDx registers can be updated when DPE = 0/1. Contents of LCDDx registers will be updated on the GUI when DPE = 1 and OPM = 1. Red will represent LCDs that are sourced; black represents LCDs that are present, but currently not sourced. LCDs not sourced can result from several factors:
- a. The PCFx bit of the LCFG registers is not SET, making the SEG pins work as I/O pins.
b. The LCD SEG pin that is multiplexed with an interrupt functionality is enabled.
c. The LCDDx register contains 0 in that bit position.
d. Moving the PC mouse on the display updates the COM and SEG.
GUI Changes for the Example Program
MAXQ2000 comes with three different pinout packages: 56, 68, and 100 pins. The test program (see Tables 1 and 2 above) tests the functionality of the MAXQ2000 68-pin package. Select the MAXQ2000 68-pin configuration from the part number list, and execute the test program. Note the GUI changes.move LCRA, #08FFh : Mode: 1/2 Mux move LCFG.0, #0h : Display: OFF move LCFG.1, #01h : OPM: Normal move LCFG.4, #01h : PCF0: Configures I/O pins as segment pins move LCFG.5, #01h : PCF1: Configures I/O pins as segment pins move LCFG.6, #01h : PCF2: Configures I/O pins as segment pins move LCFG.7, #01h : PCF3: Configures I/O pins as segment pins move EIE0.7, #01h : Enables Interrupt Function of INT7, Comment : /uncomment to see the MUX behavior of SEG pinsThe display pattern is moved from the LCDD0 register to the LCDD8 register. A 1 represents the segments to be sourced, and a 0 represents segments that will not be sourced.
move LCFG.0, #1h : Display: ONWith EIE0.7 disabled (comment move EIE0.7, #01h) and after executing the "move LCFG.0, #1" statement, the GUI display will look like Figure 3.
Figure 2. MAXQ2000 64-pin LCD panel.
After executing
move LCD0, #0ffh move LCD1, #0ffhThe GUI will look like:
Figure 3. MAXQ2000 64-pin LCD panel display changes with DPE = 1.
The difference, you will notice, is that COM0:SEG2, COM0:SEG3, COM0:SEG6, and COM0:SEG7 change color from black to red which indicates that the LCDs are sourced.
With EIE0.7 enabled (SEG31 multiplexed with INT7), the GUI will look like:
Figure 4. MAXQ2000 64-pin LCD panel with SEG multiplexed with INT.
Compare Figure 2 with Figure 4. COM0:SEG31 and COM1:SEG31 are not sourced as LCD segments.
Note: The User can design/modify the LCD display panel and MAXQ pinout input of the LCD simulator. The XML input file can be opened in any editor and XML tag names used are self-explanatory.
Conclusion
The MAXQ device simulator can be used to develop and debug the LCD simulator for MAXQ10 and MAXQ20 microcontrollers. The application developed is then ready to run on the hardware.MAXQ is a registered trademark of Maxim Integrated Products, Inc.
評論
查看更多