20x4 LCD Display with Raspberry Pi

4 次查看(过去 30 天)
Hello,
I try on displaying Text on a 20x4 LCD Screen through a Raspberry Pi 3b+. (My goal is writing a standalone program for the Raspberry)
I already have the Raspberry Toolboy for Matlab but I can't find any commands on how to display the Text.
Thanks in advance!

回答(1 个)

Shantanu Thatte
Shantanu Thatte 2021-6-25
Hi Niklas,
To interface with a 20x4 LCD with Rasperry Pi using MATLAB, you will have to first download and install the Raspberry Pi Support Package. Once that's done you will have to use either I2C or SPI bus to read/write data to your LCD. You will have to refer to the datasheet of your LCD to find which interface types your LCD supports.
If I assume that you have to use I2C to inteface with the LCD then you can use the write function to write to the I2C address. There is a more detailed example available on that page, but briefly:
% Assuming mypi is your raspberry pi
% Get instance of the conenction to I2C device at address 0x55
i2cdisplay = i2cdev(mypi,'i2c-1','0x55')
% Now write to the display
write(i2cdisplay,[hex2dec('20') hex2dec('51')])
% Or to write to a register (register 3 here)
writeRegister(i2cdisplay,3,hex2dec('08'),'uint8')
A list of all available supported functions are listed on this page.
  1 个评论
Niklas Rosenstock
Niklas Rosenstock 2021-6-25
Thanks for you answer but since I use a simple 20x4 character display these functions don't work. I don't get any errors but accept from turning the LCD Backlight on and off, nothing is happening.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Raspberry Pi Hardware 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by