Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
SAM4L Liquid Crystal Display (LCDCA) Driver

This driver for Atmel® | SMART ARM®-based microcontrollers provides an interface for the configuration and management of the device's Liquid Crystal Display Controller functionality.

The LCD controller is intended for monochrome passive Liquid Crystal Displays (LCDs) with up to four common terminals and up to 40 segment terminals.

Devices from the following series can use this module:

The outline of this documentation is as follows:

Prerequisites

There are no prerequisites for this module.

Module Overview

Display Physiology

An LCD is made up of several segments (or complete symbols), which can be visible or invisible. Any single segment has two electrodes, with liquid crystal between them. These electrodes are connected to the common terminal (COM) and the segment terminal (SEG) on the display. When a voltage above a threshold voltage is applied across the liquid crystal, the segment becomes visible. The voltage must alternate, to avoid an electrophoresis effect in the liquid crystal, which degrades the display.

Supported Display Types

The LCD Controller is intended for use with monochrome passive Liquid Crystal Displays (LCDs) with up to four common terminals and up to 40 segment terminals.

Functional Description

The LCDCA display memory stores the values of all segments to display and should be filled before the next frame starts.

The start of a new frame triggers the update of the shadow display memory. The content of the display memory is copied into the shadow display memory. A display memory refresh is possible without affecting data that is sent to the panel.

Note
The LCDCA display memory is not initialized at power-up.

When any bit in the display memory is written to a one, the corresponding LCD segment will be energized and opaque. If the same bit has zero written to it, then the corresponding LCD segment is de-energized and thus transparent.

Special Considerations

I/O Lines

The LCDCA pins (SEGx and COMy) are multiplexed with other peripherals. The user application must first configure the I/O Controller, to give control of the requisite pins to the LCDCA.

Power Management

This module can control the LCD display while CLK_LCDCA is disabled, but stops functioning when CLK_LCD (32kHz) is disabled.

The power consumption of LCDCA itself can be minimized by:

Clocks

The clock for this module (CLK_LCDCA) is generated by the Power Manager. It can be enabled or disabled, either manually (via the Power Manager) or automatically when the system enters a sleep mode that disables the clocks to the peripheral bus modules.

The 32kHz clock (CLK_LCD) must be enabled before use.

Interrupts

The LCDCA interrupt request line is connected to the Nested Vectored Interrupt Controller (NVIC). Use of the LCDCA interrupt requires the interrupt controller to be configured first.

Wake Up

The LCD Controller's wake-up signal is connected to the Power Manager Controller (PMC). Use of the wake-up mechanism requires the PMC to enable the corresponding asynchronous wake-up source first. Also, the LCDCA interrupt must be enabled first.

Debug Operation

When an external debugger forces the CPU into debug mode, the LCDCA continues normal operation.

Extra Information

For extra information, see Extra Information for Liquid Crystal Display Controller Driver. This includes:

Examples

For a list of examples related to this driver, see Examples for Liquid Crystal Display Controller.

API Overview

Modules

 
 Quick Start Guide(s)
 In this section you can find a list of all Quick Start guides related to the SAM4L Liquid Crystal Display (LCDCA) Driver.
 

Data Structures

struct  lcdca_automated_char_config
 Automated character display configuration structure. More...
 
struct  lcdca_blink_config
 Blink configuration structure. More...
 
struct  lcdca_circular_shift_config
 Circular shift configuration structure. More...
 
struct  lcdca_config
 LCDCA controller configuration structure. More...
 

Macros

#define LCDCA_AUTOMATED_CHAR_DMA_CH   3
 LCDCA automated character DMA Channel (sequential or scrolling) More...
 

Typedefs

typedef struct
lcdca_automated_char_config 
lcdca_automated_char_config_t
 Automated character display configuration structure. More...
 
typedef struct lcdca_blink_config lcdca_blink_config_t
 Blink configuration structure. More...
 
typedef void(* lcdca_callback_t )(void)
 LCDCA interrupt callback type. More...
 
typedef struct
lcdca_circular_shift_config 
lcdca_circular_shift_config_t
 Circular shift configuration structure. More...
 
typedef struct lcdca_config lcdca_config_t
 LCDCA controller configuration structure. More...
 

Functions

void lcdca_automated_char_reload (const uint8_t *data, size_t width)
 LCDCA automated display reload. More...
 
void lcdca_automated_char_set_config (struct lcdca_automated_char_config *ac_cfg)
 Configure the LCDCA automated display. More...
 
void lcdca_automated_char_start (const uint8_t *data, size_t width)
 Start the LCDCA automated display. More...
 
static void lcdca_automated_char_stop (void)
 Stop the LCDCA automated display mode. More...
 
static void lcdca_blink_disable (void)
 Disable the LCDCA blink mode. More...
 
static void lcdca_blink_enable (void)
 Enable the LCDCA blink mode. More...
 
void lcdca_blink_set_config (struct lcdca_blink_config *blink_cfg)
 Set the LCDCA blink configuration. More...
 
static void lcdca_circular_shift_disable (void)
 Disable the LCDCA circular shift mode. More...
 
static void lcdca_circular_shift_enable (void)
 Enable the LCDCA circular shift mode. More...
 
void lcdca_circular_shift_set_config (struct lcdca_circular_shift_config *cs_cfg)
 Set the LCDCA circular shift configuration. More...
 
void lcdca_clear_blink_all_pixel (void)
 Stop all LCDCA pixels/segments from blinking. More...
 
void lcdca_clear_blink_pixel (uint8_t pix_com, uint8_t pix_seg)
 Stop a specified LCDCA pixel/segment from blinking. More...
 
static void lcdca_clear_display_memory (void)
 Clear all the LCDCA display memory. More...
 
void lcdca_clear_pixel (uint8_t pix_com, uint8_t pix_seg)
 Disable the specified pixel/segment in the LCDCA display memory. More...
 
static void lcdca_clear_status (void)
 Clear the LCDCA beginning of frame interrupt status. More...
 
void lcdca_clk_init (void)
 LCDCA clock initialization. More...
 
void lcdca_disable (void)
 Disable the LCDCA module. More...
 
static void lcdca_disable_interrupt (void)
 Disable the LCDCA beginning of frame interrupt. More...
 
void lcdca_disable_timer (uint8_t lcd_timer)
 Disable the specified LCDCA timer. More...
 
static void lcdca_disable_wakeup (void)
 Disable the LCDCA wake-up. More...
 
void lcdca_enable (void)
 Enable the LCDCA module. More...
 
static void lcdca_enable_interrupt (void)
 Enable the LCDCA beginning of frame interrupt. More...
 
void lcdca_enable_timer (uint8_t lcd_timer)
 Enable the specified LCDCA timer, and wait until it is running. More...
 
static void lcdca_enable_wakeup (void)
 Enable the LCDCA wake-up. More...
 
bool lcdca_get_pixel (uint8_t pix_com, uint8_t pix_seg)
 Get the specified pixel/segment state from the LCDCA display memory. More...
 
static uint32_t lcdca_get_status (void)
 Get the LCDCA status register. More...
 
static void lcdca_lock_shadow_dislay (void)
 Lock the LCDCA shadow display memory. More...
 
void lcdca_set_blink_pixel (uint8_t pix_com, uint8_t pix_seg)
 Start an LCDCA pixel/segment blinking. More...
 
void lcdca_set_callback (lcdca_callback_t callback, uint8_t irq_line, uint8_t irq_level)
 Set the callback for the LCDCA 'beginning of frame' interrupt. More...
 
void lcdca_set_config (struct lcdca_config *lcdca_cfg)
 Configure the LCDCA controller. More...
 
void lcdca_set_contrast (int8_t contrast)
 Set the LCDCA fine contrast. More...
 
void lcdca_set_display_memory (void)
 Set all bits in the LCDCA display memory high. More...
 
void lcdca_set_pixel (uint8_t pix_com, uint8_t pix_seg)
 Enable the specified pixel/segment in the LCDCA display memory. More...
 
void lcdca_toggle_pixel (uint8_t pix_com, uint8_t pix_seg)
 Toggle the specified pixel/segment in the LCDCA display memory. More...
 
static void lcdca_unlock_shadow_dislay (void)
 Unlock the LCDCA shadow display memory. More...
 
void lcdca_write_packet (uint8_t lcd_tdg, uint8_t first_seg, const uint8_t *data, size_t width, uint8_t dir)
 Send a sequence of ASCII bytes to the LCDCA via the digit decoder. More...
 

LCDCA Address Limits

#define LCDCA_MAX_NR_OF_COM   4
 Maximum number of common lines. More...
 
#define LCDCA_MAX_NBR_OF_SEG   40
 Maximum number of segment lines. More...
 

LCDCA Display Digit

#define LCDCA_TDG_7SEG3COM   0
 7-segment display with three common terminals More...
 
#define LCDCA_TDG_7SEG4COM   1
 7-segment display with four common terminals More...
 
#define LCDCA_TDG_14SEG4COM   2
 14-segment display with four common terminals More...
 
#define LCDCA_TDG_16SEG3COM   3
 16-segment display with three common terminals More...
 

LCDCA Timer Resource

#define LCDCA_TIMER_FC0   0
 Timer FC0 resource. More...
 
#define LCDCA_TIMER_FC1   1
 Timer FC1 resource. More...
 
#define LCDCA_TIMER_FC2   2
 Timer FC2 resource. More...
 

LCDCA CMCFG Digit Reverse Mode

#define LCDCA_CMCFG_DREV_LEFT   1
 Decrement the segment index. More...
 
#define LCDCA_CMCFG_DREV_RIGHT   0
 Increment the segment index. More...
 

LCDCA Duty Selection.

#define LCDCA_DUTY_1_4   0
 Duty=1/4, Bias=1/3, COM0:3. More...
 
#define LCDCA_DUTY_STATIC   1
 Duty=Static, Bias=Static, COM0. More...
 
#define LCDCA_DUTY_1_2   2
 Duty=1/2, Bias=1/3, COM0:1. More...
 
#define LCDCA_DUTY_1_3   3
 Duty=1/3, Bias=1/3, COM0:2. More...
 

LCDCA Blink Mode

#define LCDCA_BLINK_FULL   0
 All LCD segments will blink. More...
 
#define LCDCA_BLINK_SELECTED   LCDCA_BCFG_MODE
 Only the selected segment will blink. More...
 

LCDCA Shift Register Direction

#define LCDCA_CSR_RIGHT   LCDCA_CSRCFG_DIR
 Right direction. More...
 
#define LCDCA_CSR_LEFT   0
 Left direction. More...
 

LCDCA Automated Mode.

#define LCDCA_AUTOMATED_MODE_SEQUENTIAL   0
 Sequential character string display mode. More...
 
#define LCDCA_AUTOMATED_MODE_SCROLLING   1
 Scrolling character string display mode. More...
 

LCDCA Automated Direction.

#define LCDCA_AUTOMATED_DIR_REVERSE   1
 Digit direction is reversed. More...
 
#define LCDCA_AUTOMATED_DIR_NOT_REVERSE   0
 Digit direction is not reversed. More...
 

#define LCDCA_AUTOMATED_CHAR_DMA_CH   3

LCDCA automated character DMA Channel (sequential or scrolling)

Referenced by lcdca_automated_char_reload(), lcdca_automated_char_start(), and lcdca_automated_char_stop().

#define LCDCA_AUTOMATED_DIR_NOT_REVERSE   0

Digit direction is not reversed.

Referenced by c42412a_text_scrolling_start().

#define LCDCA_AUTOMATED_DIR_REVERSE   1
#define LCDCA_AUTOMATED_MODE_SCROLLING   1

Scrolling character string display mode.

Referenced by c42364a_text_scrolling_start(), c42412a_text_scrolling_start(), main(), and run_lcdca_automated_scrolling_test().

#define LCDCA_AUTOMATED_MODE_SEQUENTIAL   0

Sequential character string display mode.

Referenced by main(), and run_lcdca_automated_sequential_test().

#define LCDCA_BLINK_FULL   0

All LCD segments will blink.

Referenced by c42364a_blink_screen(), and c42412a_blink_screen().

#define LCDCA_BLINK_SELECTED   LCDCA_BCFG_MODE

Only the selected segment will blink.

Referenced by c42364a_blink_icon_start(), c42412a_blink_icon_start(), main(), and run_lcdca_blink_test().

#define LCDCA_CMCFG_DREV_LEFT   1
#define LCDCA_CMCFG_DREV_RIGHT   0

Increment the segment index.

Referenced by c42412a_clear_text(), c42412a_show_text(), and lcdca_write_packet().

#define LCDCA_CSR_LEFT   0

Left direction.

#define LCDCA_CSR_RIGHT   LCDCA_CSRCFG_DIR

Right direction.

Referenced by main(), and run_lcdca_autonomous_test().

#define LCDCA_DUTY_1_2   2

Duty=1/2, Bias=1/3, COM0:1.

#define LCDCA_DUTY_1_3   3

Duty=1/3, Bias=1/3, COM0:2.

#define LCDCA_DUTY_1_4   0

Duty=1/4, Bias=1/3, COM0:3.

#define LCDCA_DUTY_STATIC   1

Duty=Static, Bias=Static, COM0.

#define LCDCA_MAX_NBR_OF_SEG   40

Maximum number of segment lines.

Referenced by lcdca_clear_pixel(), lcdca_set_pixel(), and lcdca_toggle_pixel().

#define LCDCA_MAX_NR_OF_COM   4

Maximum number of common lines.

Referenced by lcdca_clear_blink_all_pixel(), lcdca_clear_pixel(), lcdca_set_pixel(), and lcdca_toggle_pixel().

#define LCDCA_TDG_16SEG3COM   3

16-segment display with three common terminals

#define LCDCA_TDG_7SEG3COM   0

7-segment display with three common terminals

#define LCDCA_TDG_7SEG4COM   1

7-segment display with four common terminals

Referenced by c42364a_clear_numeric_dec(), and c42364a_write_num_packet().

#define LCDCA_TIMER_FC0   0

Automated character display configuration structure.

Blink configuration structure.

typedef void(* lcdca_callback_t)(void)

LCDCA interrupt callback type.

Circular shift configuration structure.

typedef struct lcdca_config lcdca_config_t

LCDCA controller configuration structure.

void lcdca_automated_char_reload ( const uint8_t *  data,
size_t  width 
)

LCDCA automated display reload.

Parameters
[in]dataData string buffer pointer
[in]widthData string length

References LCDCA_AUTOMATED_CHAR_DMA_CH, and pdca_channel_write_reload().

void lcdca_automated_char_start ( const uint8_t *  data,
size_t  width 
)
static void lcdca_automated_char_stop ( void  )
inlinestatic
static void lcdca_blink_disable ( void  )
inlinestatic
static void lcdca_blink_enable ( void  )
inlinestatic
void lcdca_blink_set_config ( struct lcdca_blink_config blink_cfg)

Set the LCDCA blink configuration.

Parameters
[in]blink_cfgPointer to the LCD blink configuration structure

References Assert, lcdca_blink_config::lcd_blink_mode, and lcdca_blink_config::lcd_blink_timer.

Referenced by c42364a_blink_icon_start(), c42364a_blink_screen(), c42412a_blink_icon_start(), c42412a_blink_screen(), main(), and run_lcdca_blink_test().

static void lcdca_circular_shift_disable ( void  )
inlinestatic
static void lcdca_circular_shift_enable ( void  )
inlinestatic

Enable the LCDCA circular shift mode.

Referenced by c42364a_circular_animation_start(), main(), and run_lcdca_autonomous_test().

void lcdca_circular_shift_set_config ( struct lcdca_circular_shift_config cs_cfg)

Set the LCDCA circular shift configuration.

Note
The circular shift register is disabled.
Parameters
[in]cs_cfgPointer to a circular shift configuration structure

References lcdca_circular_shift_config::data, lcdca_circular_shift_config::lcd_csr_dir, lcdca_circular_shift_config::lcd_csr_timer, and lcdca_circular_shift_config::size.

Referenced by c42364a_circular_animation_start(), main(), and run_lcdca_autonomous_test().

void lcdca_clear_blink_all_pixel ( void  )

Stop all LCDCA pixels/segments from blinking.

References lcdca_clear_blink_pixel(), and LCDCA_MAX_NR_OF_COM.

Referenced by c42364a_blink_screen(), and c42412a_blink_screen().

void lcdca_clear_blink_pixel ( uint8_t  pix_com,
uint8_t  pix_seg 
)

Stop a specified LCDCA pixel/segment from blinking.

Parameters
[in]pix_comPixel/segment COMx coordinate
[in]pix_segPixel/segment SEGy coordinate (range 0 to 1 inclusive)

References Assert.

Referenced by c42364a_blink_icon_stop(), c42364a_show_icon(), c42412a_blink_icon_stop(), c42412a_show_icon(), and lcdca_clear_blink_all_pixel().

static void lcdca_clear_display_memory ( void  )
inlinestatic

Clear all the LCDCA display memory.

Referenced by c42364a_clear_all(), and c42412a_clear_all().

void lcdca_clear_pixel ( uint8_t  pix_com,
uint8_t  pix_seg 
)

Disable the specified pixel/segment in the LCDCA display memory.

Parameters
[in]pix_comPixel/segment COMx coordinate
[in]pix_segPixel/segment SEGy coordinate

References lcdca_get_pixel_register(), LCDCA_MAX_NBR_OF_SEG, and LCDCA_MAX_NR_OF_COM.

Referenced by c42364a_clear_icon(), c42364a_clear_numeric_dec(), c42364a_show_battery(), c42364a_show_numeric_dec(), c42412a_clear_icon(), c42412a_clear_numeric_dec(), c42412a_show_battery(), c42412a_show_numeric_dec(), c42412a_show_wireless(), lcdca_toggle_pixel(), and run_lcdca_blink_test().

static void lcdca_clear_status ( void  )
inlinestatic

Clear the LCDCA beginning of frame interrupt status.

Referenced by LCDCA_Handler().

void lcdca_disable ( void  )
static void lcdca_disable_interrupt ( void  )
inlinestatic

Disable the LCDCA beginning of frame interrupt.

void lcdca_disable_timer ( uint8_t  lcd_timer)

Disable the specified LCDCA timer.

Parameters
[in]lcd_timerTimer number to be disabled

References LCDCA_TIMER_FC0, LCDCA_TIMER_FC1, and LCDCA_TIMER_FC2.

static void lcdca_disable_wakeup ( void  )
inlinestatic

Disable the LCDCA wake-up.

void lcdca_enable ( void  )

Enable the LCDCA module.

References sleepmgr_lock_mode(), and SLEEPMGR_RET.

Referenced by c42364a_init(), c42412a_init(), main(), and run_lcdca_init_test().

static void lcdca_enable_interrupt ( void  )
inlinestatic

Enable the LCDCA beginning of frame interrupt.

Referenced by lcdca_set_callback().

void lcdca_enable_timer ( uint8_t  lcd_timer)

Enable the specified LCDCA timer, and wait until it is running.

Note
The function lcdca_enable() must be called prior to this function.
Parameters
[in]lcd_timerTimer number to be enabled

References LCDCA_TIMER_FC0, LCDCA_TIMER_FC1, and LCDCA_TIMER_FC2.

Referenced by c42364a_init(), c42412a_init(), main(), and run_lcdca_init_test().

static void lcdca_enable_wakeup ( void  )
inlinestatic

Enable the LCDCA wake-up.

Referenced by main().

bool lcdca_get_pixel ( uint8_t  pix_com,
uint8_t  pix_seg 
)

Get the specified pixel/segment state from the LCDCA display memory.

Parameters
[in]pix_comPixel/segment COMx coordinate
[in]pix_segPixel/segment SEGy coordinate
Returns
The pixel/segment value from the LCDCA display memory.

References lcdca_get_pixel_register().

static uint32_t lcdca_get_status ( void  )
inlinestatic

Get the LCDCA status register.

Returns
The LCDCA status register.

Referenced by run_lcdca_autonomous_test(), run_lcdca_blink_test(), and run_lcdca_init_test().

static void lcdca_lock_shadow_dislay ( void  )
inlinestatic

Lock the LCDCA shadow display memory.

void lcdca_set_blink_pixel ( uint8_t  pix_com,
uint8_t  pix_seg 
)

Start an LCDCA pixel/segment blinking.

Parameters
[in]pix_comPixel/segment COMx coordinate
[in]pix_segPixel/segment SEGy coordinate (range 0 to 1 inclusive)

References Assert.

Referenced by c42364a_blink_icon_start(), c42412a_blink_icon_start(), main(), and run_lcdca_blink_test().

void lcdca_set_callback ( lcdca_callback_t  callback,
uint8_t  irq_line,
uint8_t  irq_level 
)

Set the callback for the LCDCA 'beginning of frame' interrupt.

Parameters
[in]callbackPointer to an interrupt callback function
[in]irq_lineInterrupt line
[in]irq_levelInterrupt priority level

References callback, lcdca_callback_pointer, and lcdca_enable_interrupt().

Referenced by main().

void lcdca_set_config ( struct lcdca_config lcdca_cfg)
void lcdca_set_contrast ( int8_t  contrast)

Set the LCDCA fine contrast.

Transfer function: VLCD = 3.0V + (fcont[5:0] * 0.016V)

Parameters
[in]contrastContrast value (range -32 to 31 inclusive)

Referenced by c42364a_set_contrast(), c42412a_set_contrast(), lcdca_set_config(), and run_lcdca_contrast_change_test().

void lcdca_set_display_memory ( void  )

Set all bits in the LCDCA display memory high.

Referenced by c42364a_show_all(), and c42412a_show_all().

void lcdca_set_pixel ( uint8_t  pix_com,
uint8_t  pix_seg 
)

Enable the specified pixel/segment in the LCDCA display memory.

Parameters
[in]pix_comPixel/segment COMx coordinate
[in]pix_segPixel/segment SEGy coordinate

References lcdca_get_pixel_register(), LCDCA_MAX_NBR_OF_SEG, and LCDCA_MAX_NR_OF_COM.

Referenced by c42364a_blink_icon_start(), c42364a_show_battery(), c42364a_show_icon(), c42364a_show_numeric_dec(), c42412a_blink_icon_start(), c42412a_show_battery(), c42412a_show_icon(), c42412a_show_numeric_dec(), c42412a_show_wireless(), lcdca_toggle_pixel(), main(), and run_lcdca_blink_test().

void lcdca_toggle_pixel ( uint8_t  pix_com,
uint8_t  pix_seg 
)

Toggle the specified pixel/segment in the LCDCA display memory.

Parameters
[in]pix_comPixel/segment COMx coordinate
[in]pix_segPixel/segment SEGy coordinate

References lcdca_clear_pixel(), lcdca_get_pixel_register(), LCDCA_MAX_NBR_OF_SEG, LCDCA_MAX_NR_OF_COM, and lcdca_set_pixel().

Referenced by main().

static void lcdca_unlock_shadow_dislay ( void  )
inlinestatic

Unlock the LCDCA shadow display memory.

void lcdca_write_packet ( uint8_t  lcd_tdg,
uint8_t  first_seg,
const uint8_t *  data,
size_t  width,
uint8_t  dir 
)

Send a sequence of ASCII bytes to the LCDCA via the digit decoder.

Note
If a NULL byte is encountered, or if the width count expires, data will no longer be sent via the digit decoder and the function returns.
Parameters
[in]lcd_tdgType of digit decoder
[in]first_segFirst SEG where the data will be written
[in]dataASCII data buffer pointer
[in]widthMaximum number of data bytes
[in]dirDirection (0 for left to right, otherwise right to left)

References LCDCA_CMCFG_DREV_LEFT, and LCDCA_CMCFG_DREV_RIGHT.

Referenced by c42364a_clear_numeric_dec(), c42364a_clear_text(), c42364a_show_text(), c42364a_write_alpha_packet(), c42364a_write_alphanum_packet(), c42364a_write_num_packet(), c42412a_clear_text(), and c42412a_show_text().