|
发表于 2023-5-7 14:45:20
|
显示全部楼层
本帖最后由 xyz123 于 2023-5-7 15:17 编辑
看了一下 en.wikipedia.org/wiki/Hitachi_HD44780_LCD_controller ,现在写的是:
- Mode selection
- ...
- Selecting 4-bit or 8-bit mode requires careful selection of commands. There are two primary considerations. First, with D3–D0 unconnected, these lines will always appear high (binary 1111) to the HD44780 since there are internal pull-up MOSFETs.[3] Second, the LCD may initially be in one of three states:
- State 1: 8-bit mode
- State 2: 4-bit mode, waiting for the first set of 4 bits
- State 3: 4-bit mode, waiting for the second set of 4 bits
- State 3 may occur, for example, if a prior control was aborted after sending only the first 4 bits of a command while the HD44780 was in 4-bit mode.
- The following algorithm ensures that the LCD is in the desired mode:
- The same command is sent three times, Function Set with 8-bit interface D7–D4 = binary 0011, the lower four bits are "don't care", using single enable pulses. If the controller is in 4-bit mode, the lower four bits are ignored so they cannot be sent until the interface is in a known size configuration.
- Starting in state 1 (8-bit configuration):
- Send Function Set command. Command will be executed, set 8-bit mode.
- Send Function Set command. Command will be executed, set 8-bit mode.
- Send Function Set command. Command will be executed, set 8-bit mode.
- Starting in state 2 (4-bit configuration, waiting for first 4-bit transfer):
- Send Function Set command. First 4 bits received.
- Send Function Set command. Last 4 bits, command accepted, set 8-bit mode.
- Send Function Set command. Command will be executed, set 8-bit mode.
- Starting in state 3 (4-bit configuration, waiting for last 4-bit transfer):
- Send Function Set command. Last 4 bits, unknown command executed.
- Send Function Set command. In 8-bit mode command will be executed, otherwise first 4 bits received.
- Send Function Set command. 8-bit command will be executed or last 4 bits of previous command; set 8-bit mode.
复制代码
三种假设情况,每种情况下三条指令的作用一口气解释完。比起 washu 看到时的「三条指令,每条对三种情况的影响」,描述起来好懂多了。
还有就是修改了HD44780的D3~D0悬空时应视为b1111,不过无关紧要。
见《http://www.crystalradio.cn/forum ... &fromuid=179981 做微波炉点焊机,接触器精确定时》
觉得日货小气,数据书写得不够详尽。又例如仪器难找维护资料,SD卡搞个专有读写模式。
看轻小说,有时见到对日文原版的生硬翻译,似乎日语行文习惯蛮啰嗦的。见OHM社的《图解晶体管电路》之类书中插图,还有网上见的日本地铁里的导向图,缤纷繁杂。
这HD44780数据书,看得也是要前前后后翻来覆去。
数据书中只给了个初始化流程图
维基百科写的,估计是对这图的揣摩。
也许某天,HD44780的设计者会冒出来编辑一下维基百科,详解这个初始化流程。
|
|