ATmega128 parallel control with font library 12864 program

Publisher:江上HZLatest update time:2012-08-02 Source: 21ic Keywords:ATmega128 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
The characteristic of ATmega128 is that it has many io ports, so we can drive this LCD screen in parallel to increase the bus speed. This program is collected from the Internet, but it has been verified by me and can be used, so it is published here. When you apply it, you only need to change the corresponding io.
Software: GCC V4.20
--------------------------------------------------------------- 
Experimental content: Write Lcd12864_ST7920.
---------------------------------------------------------------
Hardware Connection:
LCD12864_ST7920 ATmega128
1.GND               --------        GND
2.VCC               --------        VCC
3.V0                --------        NC
4.RS(CS)            --------        PD7
5.R/W(SID)          --------        PG0
6.E(SCLK) -------- PG1
7.D0                --------        PC0
8.D1                --------        PC1
9.D2                --------        PC2
10.D3 -------- PC3
11.D4 -------- PC4
12.D5               --------        PC5
13.D6               --------        PC6
14.D7 -------- PC7
15.PSB              --------        VCC
16.NC               --------        NC
17.RST              --------        VCC
18.NC               --------        NC
19.LED+             --------        VCC
20.LED-             --------        GND
The following is the program source code:
---------------------------------------------------------------*/ 
#include 
#include
#include  
#define E_set PORTG|=_BV(PG1) //LCD enable
#define  E_clear      PORTG&=~_BV(PG1)
#define RW_set PORTG|=_BV(PG0) //LCD read and write
#define  RW_clear     PORTG&=~_BV(PG0)
#define RS_set PORTD|=_BV(PD7) //LCD data
#define RS_clear PORTD&=~_BV(PD7) //LCD instruction
unsigned char j=0;
unsigned char yb=0x80;
unsigned char name00[] PROGMEM={"Flying and shooting white deer in the snowy sky,"};
unsigned char name01[] PROGMEM={"Xiaoshu Shenxia Yibiyuan."};
unsigned char name02[] PROGMEM={"Heroes have always been extraordinary and eccentric since ancient times."};
unsigned char name03[] PROGMEM={"Mr. Jin writes with all his might."};
unsigned char name10[] PROGMEM={"Li Bai is about to set off on a boat,"};
unsigned char name11[] PROGMEM={"Suddenly I heard singing on the shore."};
unsigned char name12[] PROGMEM={"The water depth of Taohuatan is a thousand feet,"};
unsigned char name13[] PROGMEM={"Not as good as the love Wang Lun gave me."};
unsigned char name20[] PROGMEM={"this is a 12864 "};
unsigned char name21[] PROGMEM={"display program,"};
unsigned char name22[] PROGMEM={"welcome to commu"};
unsigned char name23[] PROGMEM={"nicate with me! "};

void wr_com(unsigned char);
void wr_data(unsigned char);
void reset (void);
void outChinese(unsigned char,unsigned char,unsigned char *point);
void ydgb(void);
void outchar(unsigned char,unsigned char,unsigned char *point);

void wr_com(unsigned char value)//Write instruction, RS=0;RW=0 must be used when writing instruction;
{
 E_clear;
 RS_clear;
 RW_clear;
 _delay_ms(1);
 PORTC=value; //Incorporate character data
 E_set;
 _delay_ms(2); //If there is no delay, a busy check instruction must be added
 E_clear;
}
void wr_data(unsigned char sj)//Write data, RS=1;RW=0 must be set when writing data;
{
 E_clear;
 RS_set;
 RW_clear;
 _delay_ms(1);
 PORTC=sj;
 E_set;
 _delay_ms(1); //If there is no delay, a busy check instruction must be added
 E_clear;
}
void reset (void)
{
 wr_com(0x01);//Clear screen
 wr_com(0x08); //Display off
 wr_com(0x03);//Return
 wr_com(0x30); //Function setting
 wr_com(0x0f); //Open the display
 wr_com(0x01);//Clear screen
}
//****************
//outChinese is the function name
//place is the first address of the displayed address
//unit character length
//charcode[] to display the content of the data [page]
void outChinese(unsigned char place,unsigned char unit,unsigned char *point)
{
 unsigned char i,progdata;
 wr_com(place);
 for(i=0;i				   
Keywords:ATmega128 Reference address:ATmega128 parallel control with font library 12864 program

Previous article:4*4 matrix keyboard scanning and LED display program based on AVR
Next article:Summary of ATmega8's Analog Comparator

Recommended ReadingLatest update time:2024-11-17 00:21

A design scheme for a mini CNC engraving machine system
With the rapid development of industries such as art models, mechanical processing, and tooling and molds, higher and higher requirements are placed on processing equipment. As an important part of the above industries, engraving machines have also developed rapidly. At present, traditional engraving machines are larg
[Power Management]
A design scheme for a mini CNC engraving machine system
Design of embedded controller using Atmega128 microcontroller
     The embedded controller is designed with Atmega128 single-chip microcomputer. The analog input channel uses Atmega128 on-chip A/D converter, the output uses AD421 D/A converter, and the digital I/O channel is equipped with high-speed pre-coupled devices. The OSTaskStklnit() function and its related files are modi
[Microcontroller]
Design of embedded controller using Atmega128 microcontroller
Design of Taxi Dispatch Center System Based on ATmega128
At present, urban intelligent transportation systems have been widely used. Among them, the taxi center dispatch system has been fully utilized in some large cities. The taxi location and monitoring management is carried out through the global positioning system (GPS), public wireless transmission system, geographic
[Microcontroller]
Design of Taxi Dispatch Center System Based on ATmega128
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号