Shared Project: LPC832 16x2 LCD driver

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Shared Project: LPC832 16x2 LCD driver

跳至解决方案
2,177 次查看
aaronm
Contributor IV

This isn't a request for help; I'm sharing work with the community in the hopes that it helps someone else in a similar scenario.  Free to use as you wish, and I take no responsibility for any issues you have with it.

I'm doing work with a µcontroller that doesn't have tons of pins to spare for an LCD, so I decided to use an LPC832 as a 16x2 LCD driver over SPI, to reduce the number of pins needed on my main controller.  I came up with this, and it seems to work pretty well, so I thought I'd share.  I tested it with Bus Master 5's SPI mode, and it responded appropriately, but you'll have to test it with your environment.

Untar the "tgz" file, import it into MCUXpresso as a new project, connect your pins as shown in the illustration, and it should work.  It uses "command" bytes to indicate what action you want to take:

0 = clear; sub-command 0 - entire screen; 1 - the current line
1 = goto; row col
2 = print; sub-command 0 - single character; 1 - string
3 = LCD display command; command bytes relevant to your LCD display
anything else is ignored

Commands and operands are separated by spaces, so "0 0" clears the entire screen.  "2 1 ascii bytes" prints a string at the current LCD position.  "1 1 0" goto row 1 (second row; counting from offset 0), position 0.

This is configured for 16x2, but it wouldn't be hard to adjust for bigger screens.

Thanks to @ErichStyger for his HD44780 library, on which this is partially based.

https://github.com/ErichStyger/McuOnEclipseLibrary/blob/master/lib/HD44780/McuHD44780.c

标签 (1)
0 项奖励
回复
1 解答
2,157 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, thanks for your contribution on the community.

Best regards,
Pavel

在原帖中查看解决方案

1 回复
2,158 次查看
Pavel_Hernandez
NXP TechSupport
NXP TechSupport

Hello, thanks for your contribution on the community.

Best regards,
Pavel