Tuesday, March 27, 2018

LC75824 LCD driver chip library for EFM8 microcontrollers

LC75824 is an LCD driver chip. It has 4 commons so it has 1/4 duty and supports 1/2 and 1/3 bias voltages. In addition to being able to directly drive up to 204 LCD segments, the LC75824E and LC75824W can also control up to 12 general-purpose output ports. Serial data input supports CCB format communication with the system controller.
The interface between the LCD driver and the microcontroller is done by using only 3 pins (CLK, CE and DATA).
I know this is an old and rare LCD driver but the library code can be used to adapt other LCD drivers. I use this because I have a broken Samsung MM-N7 audio system with a good display using this IC.

LC75824 pinout
LC75824 pinout


LC75824 communication protocol

LC75824 communication protocol
LC75824 signal timings

There are to cases - when CLK is stopped at the low level or at the high level.
The signals are - CE (chip enable), CL or CLK (synchronization clock), DI (data input).

By looking at the above image, notice the timings between each signals. Checking the datasheet we find that all those time periods are 160 ns (nanoseconds). Initially the CLK is low. When the CLK becomes high, the driver will read the DATA bit - high or low; but the DI (DATA) pin must be set high or low 160 ns before the CLK is set high. Both CLK and DATA must be maintained high for at least 160 ns.



LC75824 serial data input

Sending serial data is done using 4 frames. Bits are sent MSB (most significant bit) first. Notice that on idle, the CE signal is low and also during address transmission. Another important thing to notice is the transition from where the address transmission ends and data transmission begins. First the data bit is set and the CE and CLK are low for at least 160 ns, then CE is pulled high for another 160 ns, after that, the CLK is pulled high for 160 ns then the protocol continues as discussed above in the signal timings, with CE being high until the frame is completed.
LC75824 serial data input frame 1
frame 1

LC75824 serial data input frame 2
frame 2
LC75824 serial data input frame 3
frame 3
LC75824 serial data input frame 4
frame 4
CCB address - this address tells the chip that we address it and is composed of 8 bits 0b10000010 in binary or 0x82 in hexadecimal. The address must be sent at the beginning of each frame.
Display data - 52 bits per frame, except the last frame when is 48 bits. This tells the LCD driver what segments to drive from 1 to 204. On frame 1 are the segments with numbers from 1 to 52 and on each frame, the next 52 until 204.

LC75824 display data to output pin correspondence
Display data to output pin correspondence
Control data - 10 bits on first 3 frames, and 14 bits on last frame. These bits control the LCD driver and are only set on first frame, the rest of frames the bits must be 0.
Control Data Functions:
  1. CU: Normal mode current drain control data. This control data bit controls the current drain in normal mode.
    0 - Normal current drain mode
    1 - Low current drain mode
  2. P0 to P3: Segment output port/general-purpose output port switching control data. These control data bits switch the segment output port/general-purpose output port functions of the S1/P1 to S12/P12 output pins.
  3. DR: 1/2 bias drive or 1/3 bias drive switching control data. This control data bit selects either 1/2 bias drive or 1/3 bias drive.
    0 - 1/3 bias drive
    1 - 1/2 bias drive
  4. SC: Segments on/off control data. This control data bit controls the on/off state of the segments.
    0 - On
    1 - Off
  5. BU: Normal mode/power-saving mode control data. This control data bit selects either normal mode or power-saving mode.
    0 - Normal mode
    1 - Power-saving mode. In this mode the OSC pin oscillator is stopped and the common and segment pins output low levels. However, the S1/P1 to S12/P12 output pins can still be used as general-purpose output ports under the control of the control data bits P0 to P3.
Data Direction (DD) - 2 bits. Represents the frame number from 0 to 3 in binary.



Library for interfacing LC75824 LCD driver with an EFM8 microcontroller

Setup

In order to use this code, first you need to set some things first in the LC75824.h file. These are IO pins, number of digits that your LCD has and the scroll speed.
CE_CLK_DATA_PORT is the port where the pins for CE, CLK and DATA are located

//-----------------------------------------------------------------------------
// Defines
//-----------------------------------------------------------------------------
// USER SETUP START
#define CE_CLK_DATA_PORT       P0
#define CE_PIN                 2
#define CLK_PIN                1
#define DATA_PIN               3

#define LCD_DIGITS             7 // number of digits
#define LCD_SCROLL_SPEED       300 // milliseconds
// USER SETUP END
//-----------------------------------------------------------------------------

Functions


LCD_WriteString()

void LCD_WriteString(const char *string, uint8_t start_position);
  • string: string to be displayed to LCD
  • start_position: digit position from where the characters will be displayed.
    Starts from 1 
     

LCD_WriteInt()

void LCD_WriteInt(int16_t number, int8_t nrOfDigits, uint8_t start_position);
  • number: display an integer on LCD. Maximum value is 32768 for negative 
    numbers and 32767 for positive
  • nrOfDigits: how many digits the number has. If this is greater than the 
    actual number of digits, the number will be padded by zeros at the beginning 
  • start_position: digit position from where the characters will be displayed.
    Starts from 1 
     

LCD_Clear()

void LCD_Clear(bool sequential_writes);
 
Clears the display. If sequential_writes is false, the display will be cleared
immediately by executing LCD_WriteString function. If sequential_writes is true
the display will be cleared only after you output something to the display, and
the LCD_WriteString function won't be executed.


LCD_ScrollString()

void LCD_ScrollString(const char *string);
 
Scrolls a string on LCD at a predefined speed

LCD_SetAnnunciator() and LCD_ClearAnnunciator()

void LCD_SetAnnunciator(uint8_t annunciator);
void LCD_ClearAnnunciator(uint8_t annunciator);
 
An annunciator is any symbol on the LCD that is not a digit. 
  • annunciator: an LCD segment number from 1 to 204 or a macro like 
    DISPLAY_STEREO, DISPLAY_ANALOG_CLOCK_SYMBOL, etc. 
    A list with all macros can be found in the library header. 
    These can be modified according to the LCD that you use.
     

LCD_NonStandardASCII()

void LCD_NonStandardASCII(uint16_t index, uint8_t start_position);
 
Display characters that are not in the standard ASCII table.
  • index: a number that represents an index used to access the FONTS
    array where the symbol is defined. 
    Also a macro can be used, like LCD_CELSIUS_DEGREE. At the moment only 
    LCD_CELSIUS_DEGREE exists and it's the last element in the FONTS array. 
    Using LCD_CELSIUS_DEGREE will display degree Celsius symbol.

Macro Functions


LCD_AllSegmentsOn()

Turn on all segments on LCD.

LCD_SetControlBits(cmd)

Send control commands to the LCD driver IC. Takes a macro as a parameter.

  • LCD_SEGMENTS_ON:  turn on all LCD segments
  • LCD_SEGMENTS_OFF:  turn off all LCD segments
  • LCD_NORMAL_MODE
  • LCD_POWER_SAVING_MODE
  •  LCD_NORMAL_CURRENT_DRAIN
  •  LCD_LOW_CURRENT_DRAIN
  • LCD_1_3_BIAS_DRIVE: 1/3 bias drive
  • LCD_1_2_BIAS_DRIVE: 1/2 bias drive
  • LCD_P0_OFF: turn off general purpose output port mode to use pins as segments instead
  • LCD_P0_ON: turn on general purpose output port mode to use segments as output pins
  • LCD_P1_OFF
  • LCD_P1_ON
  • LCD_P2_OFF
  • LCD_P2_ON
  • LCD_P3_OFF
  • LCD_P3_ON


Download links

Library - LC75824 v1.0
Datasheet - LCD Driver - LC75824E
Technical Manual - Samsung MM-N6, MM-N7

No comments:

Post a Comment

AddToAny

Related Posts Plugin for WordPress, Blogger...