Objective
A segmented Liquid Crystal Display (LCD) is made up of segments which can be made visible or invisible by applying a voltage across the liquid crystal. The SAM L22 microcontroller has a Segment LCD (SLCD) controller which is used to drive segmented LCD displays.
This tutorial shows you how to use the SAM L22's SLCD controller to drive an LCD display. You will use the SAM L22 Xplained Pro Evaluation Kit and Segment LCD1 Xplained Pro extension board (sold separately).
Two Ways to Use This Tutorial
- Create the project from scratch
- Use the provided source files and follow the step-by-step instructions given below.
- Use the solution project as an example
- Just build the solution project and download it to the SAM L22 Xplained Pro Evaluation Kit to observe the expected behavior.
Lab Objectives
- Create an Atmel Studio project from scratch for the SAM L22 microcontroller.
- Use the Advanced Software Framework (ASF) Wizard to select the ASF modules (driver(s)/component(s)/service(s)) to be used by the application.
- Setup the board and clock configuration.
- Add code to configure the SLCD controller.
- Add code to use the features of the SLCD like ASCII character mapping, software contrast control, hardware blinking, SLCD waking up from standby sleep mode, SLCD lower power consumption and scrolling on the segmented LCD display.
- Observe how your code affects the Segment LCD1 Xplained Pro board mounted on SAM L22 Xplained Pro Evaluation Kit, and monitor power consumption using the Atmel Studio Data Visualizer.
Materials
Hardware Tools
Tool | About | Purchase |
---|---|---|
SAM L22 Xplained Pro
Evaluation Kit |
| |
The Xplained Pro series evaluation kits include an onboard Embedded Debugger (EDBG). No external tools are necessary to program or debug the ATSAML22N18A. The EDBG connects to the host PC through the USB micro-B connector on the SAM L22 Xplained Pro Evaluation Kit for programming/debugging.
Hardware Connection Setup
- Connect the SEGMENT LCD1 Xplained Pro extension board on the slot EXT5 - SEGMENT LCD in the SAM L22 Xplained Pro board.
- Set the I/O current measurement jumper to BYPASS option (to disable I/O consumption information), as highlighted in the Hardware Setup figure.
- Set the MCU current measurement jumper to MEASURE option, as highlighted in the Hardware Setup figure. This is during current consumption measurement since we are interested only in MCU consumption using the Data Visualizer.
- Connect a USB cable to the DEBUG USB port for programming.
Software Tools
This project has been verified to work with the following versions of software tools:
Atmel Studio 7 (Version: 7.0.1645), ARM/GNU C Compiler :6.3.1, ASF v3.35.1 and Atmel Studio Data Visualizer extension version 2.15.713 or later.
Because we regularly update our tools, occasionally, you may discover an issue while using newer versions. If you suspect that to be the case, we recommend that you double-check using the same versions that the project was tested with.
Archived versions of our tools can be found on the following Microchip websites:
Atmel Studio 7
Note that you don't need to separately install the IDE, ARM GCC Compiler, ASF, and Data Visualizer. Installing Atmel Studio will install them all.
Tool | About | Installers |
Installation
Instructions |
||
---|---|---|---|---|---|
Windows | Linux | Mac OSX | |||
Atmel® Studio
Integrated Development Environment |
| | | | |
Advanced Software Framework v3 (ASF3)
Integrated Software Framework |
| Included with Atmel® Studio7 IDE |
Segment Liquid Crystal Display (SLCD) Controller
The segments in a segmented LCD display have two electrodes with liquid crystal between them. These electrodes are called the common terminal (COM pin) and the segment terminal (SEG pin). When a voltage above a threshold voltage is applied across the liquid crystal, the segment becomes visible.
The SAM L22 SLCD controller is intended for a monochrome passive liquid crystal display with up to eight common terminals and up to 44 segment terminals (maximum of 320 segments). Features such as character mapping, automated characters string display, and autonomous animation are implemented to reduce CPU load and power consumption.
Features
- Display capacity up to 44 segments lines and up to eight common lines (up to 320 segments)
- Selection of maximum 48 segments/common lines from 52 LCD pins
- Support from static up to 1/8 duty
- Support static, 1/2, 1/3 and 1/4 bias
- Shadow display memory for full freedom in segment update
- LCD pins as segment terminal, common terminal or general purpose I/O
- Blink mode and frequency configuration (up to 16 segments)
- Regular and low power waveform
- Software contrast adjustment control
- On-chip LCD power supply
- Character mapping
- Automated characters string scrolling
- Automated characters string display
- Automated segments display
- Autonomous animation (up to 16 segments)
- Three frame counters for timing schedule
- Interrupt request and event output for display update
- DMA Support
- SleepWalking Support
Overview:
This lab shows you how to use the SAM L22's SLCD controller to drive the Segment LCD1 Xplained Pro display on the SAM L22 Xplained Pro Evaluation Kit. It also helps you understand and use the following features: ASCII character mapping, software contrast control, hardware blinking, SLCD waking up from standby sleep mode, SLCD lower power consumption, and scrolling characters on the LCD display.
Figure 1.1 Application Flow Sequence |
- Configure Clock and Board: The function system_init initializes the SAM L22 system clock and board configurations.
- Configure SLCD: The function lcd_configure configures the SLCD hardware pin's, enables the back light and initializes the SLCD module.
- Add code for implementing SLCD Features
- The following functions will be used to implement features:
- lcd_display_string adds code for character mapping.
- lcd_sleep_mode_display displays string and moves the device back to sleep mode.
- lcd_sleep_mode_standby_conf configures SLCD to operate on low power mode.
- lcd_display_moving_string enables scrolling on the SLCD.
- Setup the following macros:
- CONF_LCD_CONTRAST for specifying the software SLCD contrast control.
- CONF_LCD_FRAME_DELAY for specifying the frame delay to demonstrate the hardware blinking feature.
- The following functions will be used to implement features:
- Observe output on Segment LCD1 Xplained Pro board mounted on SAM L22 Xplained Pro Evaluation Kit's external connector(EXT5) and Data Visualizer.
Lab Source Files and Solutions:
This ZIP file contains the completed solution project for this lab. It also contains the source files needed to perform the lab as per the following step-by-step instructions (see the "Procedure" section on this page).
The contents of this ZIP file can be placed in a folder of your choice, preferably in a top level folder of a drive.
Extracting the ZIP file will create the following folders:
- saml22_slcd contains the lab folder saml22_slcd_lab.
- saml22_slcd_lab contains the complete lab solution (saml22_slcd_lab.atsln and related files under sub folder saml22_slcd_lab) and source files to create the lab from scratch.
- dev_files contains application source files and other support files (if any) required to perform the lab from scratch (see the "Procedure" section below).
- saml22_slcd_lab.atsln is the completed lab solution project. It can be directly built and downloaded on the hardware to observe expected behaviour.
Procedure:
All steps must be completed before you will be ready to build, download, and run the application.
Lab Index
Step 1: Create a Project for the SAM L22 Microcontroller
- Step 1.1 – Create an ASF Project Using Atmel Studio IDE
Step 2: Use the ASF Wizard to Select the ASF Driver(s)/Component(s)/Service(s)
- Step 2.1 - Add SLCD, RTC and DMA Drivers
- Step 2.2 - Add Delay Routine Services
- Step 2.3 - Verify that the Board Specific Modules are Added Automatically
- Step 2.4 - Verify the Added Modules
Step 3: Add SLCD Library Files and Initialize the SLCD Controller
- Step 3.1 - Create slcd_library Folder and Add its Related Files
- Step 3.2 - Replace conf_slcd.h with conf_slcd.h Provided in the dev_files Folder
- Step 3.3 - Initialize the Segment LCD Controller
Step 4: Add Code to Control and Drive the LCD Display
- Step 4.1 - Implement ASCII Character Mapping and Software Contrast Control
- Step 4.2 - Implement Hardware Blinking
- Step 4.3 - Implement Waking up from Standby Sleep Mode and Lower Power Consumption
- Step 4.4 - Implement Scrolling