7430 views|10 replies

321

Posts

1

Resources
The OP
 

Extremely simplified LCD12864 display address conversion function [Copy link]

 
This post was last edited by shipeng on 2017-11-10 17:00 Recently, acute obsessive-compulsive cancer has recurred. I decided to simplify the LCD12864 display address conversion function. The goal is not to see the branch structure in it. I racked my brains and spent countless time and finally barely completed it: Before simplification: //Set display position //x=0-7,y=0-3 void LCD_SetCursor(u8 x,u8 y) { if (y==0) {y=0x80;} else if (y==1) {y=0x90;} else if (y==2) {y=0x88;} else if (y==3) {y=0x98;} LCD_Wcmd(x+y); //Display address } After simplification: //Set display position //x=0-7,y=0-3 void LCD_SetCursor(u8 x,u8 y) { y=y>>1|y<<1&3; y=0x80+y*8; LCD_Wcmd(x+y); //Display address } I have always used it and the display is normal;
This post is from MCU

Latest reply

Currently studying  Details Published on 2018-4-17 09:12

赞赏

1

查看全部赞赏

Personal signature模电临时工
 

28

Posts

0

Resources
2
 
Newbies can't understand
This post is from MCU

Comments

Have you ever used LCD12864?  Details Published on 2018-4-16 09:31
 
 

321

Posts

1

Resources
3
 
yulin3192 posted on 2018-4-15 19:30 Newbies can’t understand it
Have you ever used LCD12864?
This post is from MCU
 
Personal signature模电临时工
 
 

1903

Posts

0

Resources
4
 
It's very simple, give it a thumbs up
This post is from MCU
 
 
 

369

Posts

0

Resources
5
 
Thanks for sharing
This post is from MCU
 
Personal signature充放电数显全套方案,双口快充慢充检测电流电压,两线三线直流电压表,配套三个8尺寸15*8MM带AV电流电压单位专利数码屏,资料QQ2981074992 邮箱同上
 
 

28

Posts

0

Resources
6
 
shipeng posted on 2018-4-16 09:31 Have you ever used LCD12864?
I am learning it now
This post is from MCU
 
 
 

28

Posts

0

Resources
7
 
shipeng posted on 2018-4-16 09:31 Have you ever used LCD12864?
I am currently learning
This post is from MCU

Comments

In fact, this is the situation: After analysis and summary, it is found that the value of y only needs to be swapped when it is 0b01 (1) or 0b10 (2), that is, 1 becomes 2, and 2 becomes 1. It remains unchanged when it is 0b00 (0) and 0b11 (3). After the conversion is completed, multiply the new y value by 8 and add 0x80.  Details Published on 2018-4-16 18:48
 
 
 

321

Posts

1

Resources
8
 
yulin3192 posted on 2018-4-16 18:02 I am currently studying
This is actually the case: After analysis and summary, it was found that the value of y only needs to be swapped when it is 0b01 (1) or 0b10 (2), that is, 1 becomes 2, and 2 becomes 1. It remains unchanged when it is 0b00 (0) and 0b11 (3). After the conversion is completed, multiply the new y value by 8 and add 0x80.
This post is from MCU
 
Personal signature模电临时工
 
 

28

Posts

0

Resources
9
 
shipeng posted on 2018-4-16 18:48 In fact, this is the situation: After analysis and summary, it is found that the value of y only needs to be interchanged when it is 0b01 (1) or 0b10 (2), that is, 1 becomes 2, and 2 becomes 1. 0b00 (0 ...
I still don't understand. Can the host send an example to see
This post is from MCU

Comments

Take a look at the LCD12864 specification: [attachimg]351350[/attachimg][attachimg]351351[/attachimg] The LCD12864 driver chip actually has only 32 rows of Y and 16*16 columns of X. But the actual screen needs 64 rows and 8*16 columns. The implementation method is to use Line3 and Line4 when X is larger than 7*16 columns.  Details Published on 2018-4-17 08:21
 
 
 

321

Posts

1

Resources
10
 
yulin3192 posted on 2018-4-16 20:23 I still don't understand. Can you please give me an example?
Let's take a look at the specification of LCD12864: The actual Y of the driver chip of LCD12864 is only 32 rows, and X is 16*16 columns. But the actual screen needs 64 rows and 8*16 columns. The implementation method is that when X is larger than 7*16 columns, it is used as Line3 and Line4, so the Y position of Line2 and Line3 needs to be swapped.
This post is from MCU
 
Personal signature模电临时工
 
 

8

Posts

0

Resources
11
 
Currently studying
This post is from MCU
 
 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list