Microchip® Advanced Software Framework

Quick Start Guide for the LCDCA Driver

This is the quick start guide for the SAM4L Liquid Crystal Display (LCDCA) Driver, with step-by-step instructions on how to configure and use the driver for a specific use case.

The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, for example, the main application function.

Use Cases

LCDCA Basic Usage

This use case will demonstrate how to configure and use the LCDCA module to address an external LCD segment (C42048A).

Setup Steps

Prerequisites

This module requires the following services:

Setup Code Example

Add these code segments to the main loop, or to a setup function in your application's C-file:

#define PORT_MASK  40
#define LCD_DUTY   LCDCA_DUTY_1_4
#define LCD_CONTRAST_LEVEL 30

struct lcdca_config lcdca_cfg; 
// LCDCA Controller initialization
// - Clock,
// - Connect to C42364A glass LCD component,
// - Timing: 64 Hz frame rate & low power waveform, FC0, FC1, FC2
// - Interrupt: off.
lcdca_cfg.port_mask = PORT_MASK;
lcdca_cfg.x_bias = false;
lcdca_cfg.lp_wave = true;
lcdca_cfg.duty_type = LCD_DUTY;
lcdca_cfg.lcd_pres = false;
lcdca_cfg.lcd_clkdiv = 3;
lcdca_cfg.fc0 = 16;
lcdca_cfg.fc1 = 2;
lcdca_cfg.fc2 = 6;
lcdca_cfg.contrast = LCD_CONTRAST_LEVEL;
lcdca_set_config(&lcdca_cfg);
/* Turn on LCD back light */

Basic Setup Workflow

  1. Initialize the LCDCA clock:
  2. Configure the LCDCA module:
    lcdca_set_config(&lcdca_cfg);
  3. Enable the LCDCA module:
  4. Enable the frame counter timers:
  5. Turn on the LCD backlight:

Usage Steps

Normal Usage

The following functions can be used to set/clear/toggle one pixel/segment:

The function lcdca_write_packet() can be used to display ASCII characters:

// Display in alphanumeric field.

The LCD contrast can be changed using:

lcdca_set_contrast(contrast_value);

Using Hardware Blinking

To use hardware blinking:

Using Hardware Autonomous Animation

To use the hardware's autonomous segment animation:

cs_cfg.lcd_csr_timer = LCDCA_TIMER_FC1;
cs_cfg.lcd_csr_dir = LCDCA_CSR_RIGHT;
cs_cfg.size = 7; // Total 7-pixels.
cs_cfg.data = 0x03; // Display 2 pixel at one time.

Using Hardware Automated Character

To use hardware automated character (e.g., scrolling here):

struct lcdca_automated_char_config automated_char_cfg;
uint8_t const scrolling_str[] = \
"Scrolling string display, Press PB0 to cont. ";
automated_char_cfg.automated_mode = LCDCA_AUTOMATED_MODE_SCROLLING;
automated_char_cfg.automated_timer = LCDCA_TIMER_FC2;
automated_char_cfg.lcd_tdg = LCDCA_TDG_14SEG4COM;
automated_char_cfg.stseg = FIRST_14SEG_4C;
automated_char_cfg.dign = WIDTH_14SEG_4C;
/* STEPS = string length - DIGN + 1 */
automated_char_cfg.steps = sizeof(scrolling_str) - WIDTH_14SEG_4C + 1;
automated_char_cfg.dir_reverse = LCDCA_AUTOMATED_DIR_REVERSE;
lcdca_automated_char_set_config(&automated_char_cfg);
lcdca_automated_char_start(scrolling_str, strlen((char const *)scrolling_str));