#include
#include
#define EN 0
#define RS 1
#define CS1 2
#define CS2 3
unsigned char a[32]={
0xEF,0xFB,0xEF,0xFC,0x2F,0xFF,0x00,0x00,0x6F,0xFF,0xEF,0xDC,0xFF,0xEF,0xBD,0x73,
0x1D,0xBC,0xAD,0xDF,0xB5,0xE7,0x39,0xB8,0xBD,0x7F,0xBF,0xBF,0x3F,0xC0,0xFF,0xFF
};
unsigned char ying[32]={
0xFF,0xBF,0xFF,0xCF,0x03,0xF0,0xFB,0xBF,0xBB,0xBF,0x7B,0xBE,0xFB,0xB1,0xDA,0xBF,
0x39,0xBF,0xFB,0x9C,0xFB,0xAF,0xFB,0xB3,0xFB,0xBC,0x1B,0xBF,0xFB,0xBF,0xFF,0xFF/*"应",0*/
};
unsigned char peng[32]={
0xFF,0x7F,0xFF,0x9F,0x01,0xE0,0xDD,0xFD,0xDD,0xBD,0xDD,0x7D,0x01,0x80,0xFF,0x7F,
0xFF,0x9F,0x01,0xE0,0xDD,0xFD,0xDD,0xBD,0xDD,0x7D,0x01,0x80,0xFF,0xFF,0xFF,0xFF/*"朋",0*/
};
unsigned char sbily1988[80]={0xFF,0xFF,0xFF,0xCC,0x7F,0xDB,0x7F,0xDB,0x7F,0xDB,0x7F,0xDB,0x7F,0xE6,0xFF,0xFF,/*"s",0*/
0xF7,0xFF,0x07,0xC0,0xFF,0xEE,0x7F,0xDF,0x7F,0xDF,0xFF,0xEE,0xFF,0xF1,0xFF,0xFF,/*"b",1*/
0xFF,0xFF,0x7F,0xDF,0x67,0xDF,0x67,0xC0,0xFF,0xDF,0xFF,0xDF,0xFF,0xFF,0xFF,0xFF,/*"i",2*/
0xFF,0xFF,0xF7,0xDF,0xF7,0xDF,0x07,0xC0,0xFF,0xDF,0xFF,0xDF,0xFF,0xFF,0xFF,0xFF,/*"l",3*/
0x7F,0x7F,0x7F,0x7E,0x7F,0x71,0xFF,0x8F,0xFF,0xE7,0x7F,0xF9,0x7F,0xFE,0x7F,0xFF,/*"y",4*/
};
void init();
void wcom(unsigned char);
void wdata(unsigned char);
void show(unsigned char data[],unsigned char,unsigned char,unsigned char);
void main()
{
heat();
while(1)
{
show(which,32,0xb9,0xb8);
show(ying,32,0xbb,0xba);
show(peng,32,0xbd,0xbc);
show(sbily1988,80,0xbf,0xbe);
while(1);
}
}
void init() //initialization function
{
DDRC=0xff; DDRD=0xff;
PORTC=0xff; PORTD=0xff;
wcom(0x3f); //Turn on LCD display
PORTD|=BIT(CS1); //Turn off the right half plane display
PORTD&=~BIT(CS2); //Open the left half plane display
}
void wcom(unsigned char data) //write command
{
PORTD|=BIT(ONE);
PORTD&=~BIT(RS);
PORTC=data;
PORTD&=~BIT(EN);
PORTD|=BIT(RS);
}
void wdata(unsigned char data) //write data
{
PORTD|=BIT(ONE);
PORTD|=BIT(RS);
PORTC=data;
PORTD&=~BIT(EN);
PORTD&=~BIT(RS);
}
void show(unsigned char data[],unsigned char sum,unsigned char a,unsigned char b)//显示函数
{ /*data[], font first address; sum, array length; a, next page; b previous page*/
unsigned char i;
for(i=0;i
Postscript: I used iccavr7.22 version. I wanted to make the font into a table and put it in flash. I tried it according to the method on the Internet.
{
if(i%2) {wcom(a); wcom(0x40+(i/2));}
else {wcom(b);wcom(0x40+(i-1)/2+1);}
wdata(data[i]);
}
}
Postscript: I used iccavr7.22 version. I wanted to make the font into a table and put it in flash. I tried it according to the method on the Internet.
1)“const unsigned char a[]={};
2)#pragma data:code
const unsigned char a[]={};
#pragma data:data
"All failed. In the first case, the compilation passed, but after compilation, I found that it still defined the array in RAM.
In the second case, the compilation fails and the message "cannot initialize RAM area" is always displayed.
Later I searched online for a long time and tried again flash unsigned char a[]={};
This time the compilation passed and it is easy to see that it is indeed in the flash
Area Addr Size Decimal Bytes (Attributes)
-------------------------------- ---- ---- ------- ----- ------------
lit 0054 00B0 = 176. bytes (rel,con,rom)
Addr Global Symbol
----- --------------------------------
0054 __lit_start
0054 _the
0074 _ying
0094 _peng
00B4 _sbily1988
0104 __lit_end
Here lit means it exists in flash. But one thing needs to be noted, if it is defined with flash unsigned char, the data type of the function parameter must also be flash unsigned char, otherwise an error will occur.
Previous article:AVR IAP Function
Next article:AVR microcontroller serial port program based on Proteus simulation
Recommended ReadingLatest update time:2024-11-16 13:29
Design of high-precision electronic scale based on AVR microcontroller
0 Introduction
With the continuous development of electronic technology and automated measurement technology, traditional weighing systems can no longer meet people's needs in terms of function, accuracy, cost performance, etc., especially in terms of intelligence, portability, and measurement of tiny masses. I
[Microcontroller]
Creating Machine Life with AVR MCU
1 What is machine life?
Machine life is a machine that can survive autonomously, a machine that automatically struggles to survive. For machine life, survival means continuing to run without power outages. Machine life has the characteristics of completely autonomous decision-making, autonomous actions, activit
[Microcontroller]
AVR single chip digital tube display clock program
//Digital tube data P0 port, digital tube control P2 port #include avr/io.h #include avr/delay.h #include avr/pgmsPACe.h #include avr/signal.h #include avr/interrupt.h #define code PROGMEM #define uchar unsigned char #define uint unsigned int code const uchar LED_7 = {0x28, 0x7E, 0xA2, 0x62, 0x74, 0x61, 0x21, 0x7A
[Microcontroller]
PIC microcontroller drives LCD12864 liquid crystal display flashing font program
/****************************************************** *********************
*** Function: 12864LCD display shows flashing fonts, students can modify it by themselves.
*** Experimental content: 0x81 0x90 0x88 0x98 are the row start addresses of the four lines of LCD respectively. The characters we operate the LCD re
[Microcontroller]
How to design an SPI serial peripheral interface based on AVR microcontroller?
1. SPI interface of AVR microcontroller The SPI (Serial Peripheral INTERFACE) bus system is a synchronous serial peripheral interface that allows the MCU to communicate and exchange data with various peripheral devices in a serial manner. It is widely used in various industrial control fields. Based on this standard,
[Microcontroller]
AVR MCU controls RTL8019AS to implement Ethernet interface design
Introduction: This article introduces a method of using AVR microcontroller to realize Ethernet interface circuit, which has few hardware circuits, simple structure and easy use. With the rapid development of the Internet, various household appliances and instruments are gradually becoming networked in order to shar
[Microcontroller]
Design of information monitoring terminal using AVR single chip microcomputer and LCD module
At present, with the rapid development of the information industry, all kinds of ships are in urgent need of being equipped with more high-quality and low-cost small and medium-sized information monitoring terminals to monitor weather conditions and obtain navigation information to ensure navigation safety. 32-bit pro
[Microcontroller]
Design of Presettable Programmable Broadband DC Power Amplifier Circuit Based on AVR Microcontroller
This paper uses AVR single-chip microcomputer ATmegal28 as the core controller, combined with 10-bit serial D/A chip TLC5615, power amplifier THS3092, programmable gain amplifier AD603 and other related circuits to form a preset programmable broadband DC power amplifier circuit. The gain adjustment range of this cir
[Microcontroller]
- Popular Resources
- Popular amplifiers
Recommended Content
Latest Microcontroller Articles
He Limin Column
Microcontroller and Embedded Systems Bible
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
MoreSelected Circuit Diagrams
MorePopular Articles
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
MoreDaily News
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
Guess you like
- What are the types of LDOs used in portable mobile devices? Ripple test methods
- 【CH579M-R1】+Complete the read and write operations on AT24C32EEPROM
- How to burn the program to Renesas H8S/2398 (HD64F2398FV20)
- Questions about option byte
- 【ESP32-Korvo Review】(2) Getting to know ESP32
- Ask about ESP32 remote upgrade
- RglComm is an open source USB control software for Rigol devices
- Share a charging automatic switching power supply circuit
- KEIL compile error No such file or directory
- Freescale's MC9S12XET256 chip, please help me with the problem of multiplexing function mapping