20x4 LCD Display with Raspberry Pi

조회 수: 4 (최근 30일)
Niklas Rosenstock
Niklas Rosenstock 2021년 6월 25일
댓글: Niklas Rosenstock 2021년 6월 25일
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