Single chip LCD12864 with font library can call display function can reverse display source program

Publisher:TapirLatest update time:2020-08-20 Source: 51heiKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

When I used LCD12864, I used JLX12864G-086-pc, which is an LCD12864 screen with font library. I adopted the SPI serial port method and modified it according to the standard routines provided by the manufacturer. It was made into an independent function module that can be called, and the displayed text can be highlighted. The corresponding header file is also provided.


1. Convert the P3.0, P3.1, and P3.2 interfaces provided by the routine to P3.4, P3.5, and P3.6

2. Added a parameter to indicate whether to display in reverse video in the display call parameter: 0 = no reverse video, 1 = reverse video

3. For the 5X8 display with highlighted text, one more column is added to eliminate the spaces between characters, making the characters clearer.


The microcontroller source program is as follows:

#ifndef __JLX1286486PC_H_

#define __JLX1286486PC_H_

/**********************************

JLX12864G-086S-PC uses SPI serial port, communication, with font library, a total of 12 pins

1 ROM_IN Font IC interface SI serial data input

2 ROM_OUT Font IC interface SO serial data output

3 ROM_SCK Font IC interface SCLK serial clock input

4 ROM_CS Font IC interface CS# Chip select input

5 LEDA Backlight power Backlight power positive pole, same as VDD voltage (5V or 3.3V)

6 VSS Ground 0V

7 VDD Circuit power supply 5V, or 3.3V optional

8 SCLK I/O Serial clock

9 SDA I/O Serial data

10 RS Register selection signal H: Data register 0: Instruction register (written as "A0" on IC data)

11 RESET Reset low level reset, after reset is completed, return to high level, the LCD module starts working

12 CS Chip select low level chip select

*********************************/


/**********************************

Include header files

**********************************/

#include

#include


//---Redefine keywords---//

#ifndef uchar

#define uchar unsigned char

#endif


#ifndef uint

#define uint unsigned int

#endif

#ifndef ulong

#define ulong unsigned long

#endif

/**********************************

PIN port definition

**********************************/

sbit lcd_sclk =P3^6; //in the example =P3^2; Interface definition: lcd_sclk is the SCLK of the LCD

sbit lcd_sid =P3^5; //in the example =P3^1; Interface definition: lcd_sid is the SDA of the LCD

sbit lcd_rs = P3^4; // in the example = P3^0; Interface definition: lcd_rs is the RS of LCD, also called "CD"

sbit lcd_reset=P1^0; //Interface definition: lcd_reset is the LCD RESET

sbit lcd_cs1 =P1^1; //Interface definition: lcd_cs1 is CS1 of LCD


sbit Rom_IN =P1^2; //Font IC interface definition: Rom_IN is the SI of the font IC

sbit Rom_OUT=P1^3; //Font IC interface definition: Rom_OUT is the SO of font IC

sbit Rom_SCK=P1^4; //Font IC interface definition: Rom_SCK is the SCK of the font IC

sbit Rom_CS =P1^5; //Font IC interface definition Rom_CS is the CS of font IC#


/**************************************+


Function declaration

**********************************/

//Delay

void lcddelay(int n_ms);               

//Short delay

void lcddelay_us(int n_us);              

//Write instructions to the LCD module

void transfer_command_lcd(int data1);

//Write data to LCD module

void transfer_data_lcd(int data1);

//LCD module initialization

void initial_lcd();

void lcd_address(uint page,uint column);

//Clear the entire screen

void clear_screen();

//Display 128x64 dot matrix image

void display_128x64(uchar *dp);

//Display 16x16 dot matrix images, Chinese characters, rare characters or other icons of 16x16 dot matrix

void display_graphic_16x16(uchar page,uchar column,uchar *dp);

//Display 8x16 dot matrix images, ASCII, or 8x16 dot matrix self-made characters, other icons

void display_graphic_8x16(uchar page,uchar column,uchar *dp);

//Display 5X8 dot matrix images, ASCII, or 5x8 dot matrix self-made characters, other icons

void display_graphic_5x8(uchar page,uchar column,uchar *dp);

//Send instructions to the Jinglianxun font library IC

void send_command_to_ROM( uchar datu );

//Get Chinese characters or character data (1 byte) from the Jinglianxun character library IC

static uchar get_data_from_ROM() ;

// Read data from the specified address and write it to the specified (page, column) coordinates of the LCD screen, uchar fb specifies whether to display in reverse video

void get_and_write_16x16(ulong fontaddr,uchar page,uchar column,uchar fb);

// Read data from the specified address and write it to the LCD screen at the specified (page, column) coordinates uchar fb specifies whether to display in reverse video

void get_and_write_8x16(ulong fontaddr,uchar page,uchar column,uchar fb);

// Read data from the specified address and write it to the LCD screen at the specified (page, column) coordinates uchar fb specifies whether to display in reverse video

void get_and_write_5x8(ulong fontaddr,uchar page,uchar column,uchar fb);

//uchar fb specifies whether to display in reverse video

void display_GB2312_string(uchar page,uchar column,uchar *text,uchar fb);

//uchar fb specifies whether to display in reverse video

void display_string_5x8(uchar page,uchar column,uchar *text,uchar fb);

#endif

Keywords:MCU Reference address:Single chip LCD12864 with font library can call display function can reverse display source program

Previous article:16*64LED dot matrix clock (moving + page turning display) MCU source program
Next article:The single-chip LCD12864G has independent functions with fonts, which can be called

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号