PIC16 LCD 12864b控制
我正在尝试在PIC16F环境(PIC16F84A)上使用12864b 7920 LCD。由于我在微处理器领域不太熟练,所以我采用了一个通用的4位控制程序来了解它。之后,我使用XC8构建并测试了固件,将其模拟在Proteus 8.13上(感谢制作了12864B型号的Github家伙!),也可以在相同行为相同的合适的面包板硬件电路上进行模拟。该学习示例仅使用2行显示,而12864B可以显示4行乘16个字符。显示控制器的命令是相同的,因此在12864b上逆转我没有问题。当我试图填写所有4行文本时,问题出现了:当第一行填充时,要填充的下一行不是合乎逻辑的,第二行是合乎逻辑的,而是第四行。然后,继续,第二和第三。然后,我查找了显示数据表,并从Sitronix发现了一个涵盖7920 LCD控制器的文献记载的。在此数据表上,指出每行的起始地址为HX80、90、a0,b0。但是,当我提出命令将光标转移到这些地址时,前两个,80和90h的行为表现为预期,而其他则根本没有显示。篡改地址,我能做的最好的是也在第四行中显示,但是从98h开始,而不是部分覆盖第二行,而是从第四排的第一个字符开始。我花了整整几天的时间试图弄清楚是否还有其他命令可以在行之间交换光标,也可以搜索很多,但是我只找到了一些Arduino项目,这些项目隐藏了Arduino库背后的细节。 作为最后的观察,我可以说,如果我给出一个地址> b0h,我将覆盖第一行。我通常的测试文本是“快速的棕色狐狸跳过懒狗0123456789”,分为16个字符的块,或者4个字符串” x123456789abcdf”,我在其中更改为y,z,t的第一个char。我目前必须正确显示一行的唯一方法是避免使用最初的80h的任何光标控制代码,并以字符以字符发送16 x 4个字符的数组,预先插入x,z,y,t 1- 16、33-48、17-32、49-64。这对Proteus或硬件都有效。是否有人知道将光标发送到每行请求的位置的“魔法代码”?我还补充说,我试图通过大量数量修改程序中的延迟,但即使这也无法解决问题。
最后我明白了,所以我在这里发布了解决方案,以节省其他人浪费时间和耐心...这是根据Proteus模拟LCD12864B的真实地址: line1-> 0x80,line2-> 0x90,line3-> 0xc8,line4-> 0xd8。 我不得不将所有的行都避免以避免编辑器控件将它们作为代码。 硬件测试也确认了物理显示上的地址。
就这样。
I'm trying to use 12864B 7920 LCD on a PIC16F environment (PIC16F84A). As I'm not so skilled in the microprocessor field, I took a generic 4-bit control program to learn about it. Following that, I built and tested the firmware with XC8,simulating it on Proteus 8.13 (thank you to GITHUB guys that made the 12864B model!) and also on a suitable breadboarded hardware circuit that behaved identically. This learning example uses a 2-rows only display, while the 12864B can display 4 rows by 16 characters each. The commands to the display controller are identical, so I had no problem in reversing on the 12864B. The problems came when I tried to fill with text all the 4 lines: when the first row was filled, the next row to be filled wasn't as it could be logical, the second, but the 4th one. And then, going on, the 2nd and the 3rd. I then looked for the display datasheet, and found a well documented one from Sitronix, that covered the 7920 LCD controller. On this datasheet it's stated that the starting address of each row is hx80, 90, A0, B0. But when I put commands to move the cursor to those addresses, the first two, 80 and 90h behaved as expected, while the others weren't displayed at all. Tampering with the addresses, the best I could do was to also display on the 4th row, but starting at 98h, that instead of partially overwriting the 2nd row, starts on the 1st char of the 4th row. I spent whole days trying to figure if there were some other command to swap the cursor between the rows, also googling a lot, but I only found some Arduino projects that hide details behind Arduino libraries.
As a last observation, I can tell that, if I give an address >B0h I overwrite the 1st row. My usual test texts are either "The quick brown fox jumps over the lazy dog 0123456789" partitioned into 16 characters chunks, or 4 strings "x123456789ABCDF" where I change the 1st char with y, z, t. The only way I presently have to correctly display a row is to avoid any cursor control code past the initial 80h and simply send character by character an array of 16 x 4 characters pre-scrambled in the order x,z,y,t 1-16, 33-48, 17-32, 49-64. And this works on either Proteus or hardware. Does anybody know the "magic code" that sends cursor to the requested position on every row? I also add that I tried to modify the delays in the program by a great amount, but even this didn't solve the problem.
At last I got it, so I post here the solution, to save other people wasting time and patience... Here are the true addresses as per the Proteus simulated LCD12864B:
line1->0x80,line2->0x90, line3->0xC8,line4->0xD8.
I had to put all the lines that way to avoid the editor control takes them as code.
Also an hardware test confirms the addresses on the physical display.
That's all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最后,我明白了,所以我在这里发布了解决方案,以节省其他人浪费时间和耐心...这是根据Proteus模拟LCD12864B的真实地址:line1-> 0x80,line2-> 0x90,line3-- > 0xc8,line4-> 0xd8。我不得不将所有的行都避免以避免编辑器控件将它们作为代码。硬件测试也确认了物理显示上的地址。
就这样。
At last I got it, so I post here the solution, to save other people wasting time and patience... Here are the true addresses as per the Proteus simulated LCD12864B: line1->0x80,line2->0x90, line3->0xC8,line4->0xD8. I had to put all the lines that way to avoid the editor control takes them as code. Also an hardware test confirms the addresses on the physical display.
That's all.