Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Oct 2021 10:57:47 +0700
From:      Olivier <Olivier.Nicole@cs.ait.ac.th>
To:        "Dr. Rolf Jansen" <rj@obsigna.com>
Cc:        freebsd-arm@freebsd.org
Subject:   Re: Using 20x4 LCD display
Message-ID:  <wu7wnm1iwn8.fsf@banyan.cs.ait.ac.th>
In-Reply-To: <E5B8D95E-5D51-46CA-9BBE-F1470E866EE8@obsigna.com> (rj@obsigna.com)

next in thread | previous in thread | raw e-mail | index | archive | help
"Dr. Rolf Jansen" <rj@obsigna.com> writes:

>> Am 22.10.2021 um 03:52 schrieb Olivier <Olivier.Nicole@cs.ait.ac.th>:
>>=20
>> I would like to use a 20x4 LCD display attached to a Raspberry Pi
>> running FreeBSd 12.2.
>>=20
>> I can talk to the display through the I2C interface, when I send
>> something the back light will turn off and on, so the link is
>> established.
>
> I use a 20x4 LCD (HD44780 type) over I2C (via PCF8574T) on a BeagleBone B=
lack. For this, I manually transcribed one of the many Python libraries int=
o plain C, and I wrote a minimalistic I2C glue interface in C, so it can be=
 easily addressed.
>
> I just put a .zip file for downloading it on my web site:
>
>    https://obsigna.com/Downloads/LCD_20x4_over_I2C.zip
>
> I added a Hello World test program (s. below). Perhaps you need to change=
 the I2C device number and the I2C address in lcd.c. Here I have:
>
>    uint8_t lcd_iicid =3D 1;
>    uint8_t lcd_addr  =3D 0x27;
>
> The Python code contained a lot of delays between various calls. This was=
 not necessary for the BeagleBone Black, I removed this and it let me optim=
ize the subroutines for transferring data to the display. I don=E2=80=99t k=
now whether this would work on a Raspberry Pi, though.
>
> Compile it with: cc i2c.c lcd.c hello.c -o hello
> Run it with: ./hello
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <stdint.h>
> #include <unistd.h>
>
> #include "i2c.h"
> #include "lcd.h"
>
> int main(int argc, const char *argv[])
> {
>    lcd_begin();
>    lcd_print("Hello, World!", 13);
>    lcd_setCursor(0, 1);
>    lcd_print("HD44780 over PCF8574", 20);
>    lcd_setCursor(0, 2);
>    lcd_print("If it does not work,", 20);
>    lcd_setCursor(0, 3);
>    lcd_print("do not ask me why.", 18);
>
>    return 0;
> }
>
> Best regards
>
> Rolf

Than you Rolf, that was very usefull.

Can I use your code in a small project that I am writting and that I
will put online? (project is an access control system based on user
password rather than fingerprint, RFID, etc., that password is taken
directly from LDAP, so one less thing to manage when users come and go).

What copyright/acknoledgment should I include then?

Best regards,

Olivier

--=20



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?wu7wnm1iwn8.fsf>