This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot-open:practical:hardware:sut:stm32:emb5_1 [2024/04/10 19:44] – [Prerequisites] ktokarz | en:iot-open:practical:hardware:sut:stm32:emb5_1 [2024/04/10 20:20] (current) – [Steps] ktokarz | ||
---|---|---|---|
Line 5: | Line 5: | ||
===== Prerequisites ===== | ===== Prerequisites ===== | ||
- | Familiarise yourself with a hardware reference. LCD of this type can be connected to the microcontroller with 8 or 4 lines of data, RS - register select, R/#W - read/write, and EN - synchronisation line. In our lab equipment, the LCD is controlled with 6 GPIOs. We use 4 lines for data and because We don't read anything from the LCD the R/#W is connected to the ground. | + | Familiarise yourself with a hardware reference. LCD of this type can be connected to the microcontroller with 8 or 4 lines of data, RS - register select, R/#W - read/write, and EN - synchronisation line. In our lab equipment, the LCD is controlled with 6 GPIOs. We use 4 lines for data and because We don't read anything from the LCD the R/#W is connected to the ground. Details can be found in //Table 1: STM32WB55 Node Hardware Details// on the STM32 laboratory hardware reference page. |
You are going to use a library to handle the LCD. It means you need to add it to your '' | You are going to use a library to handle the LCD. It means you need to add it to your '' | ||
<code bash> | <code bash> | ||
- | lib_deps = adafruit/Adafruit | + | lib_deps = arduino-libraries/ |
</ | </ | ||
===== Suggested Readings and Knowledge Resources ===== | ===== Suggested Readings and Knowledge Resources ===== | ||
* [[en: | * [[en: | ||
- | * [[en: | + | * [[en: |
* [[en: | * [[en: | ||
- | * [[en: | + | * [[en: |
===== Hands-on Lab Scenario ===== | ===== Hands-on Lab Scenario ===== | ||
Line 30: | Line 30: | ||
Include the library in your source code: | Include the library in your source code: | ||
<code c> | <code c> | ||
- | #include <Adafruit_LiquidCrystal.h> | + | #include <LiquidCrystal.h> |
</ | </ | ||
Line 36: | Line 36: | ||
Declare GPIOs controlling the LCD, according to the hardware reference: | Declare GPIOs controlling the LCD, according to the hardware reference: | ||
<code c> | <code c> | ||
- | #define LCD_RS 2 | + | const int rs = PC5, en = PB11, d4 = PB12, d5 = PB13, d6 = PB14, d7 = PB15; |
- | #define LCD_ENABLE 1 | + | |
- | #define LCD_D4 39 | + | |
- | #define LCD_D5 40 | + | |
- | #define LCD_D6 41 | + | |
- | #define LCD_D7 42 | + | |
</ | </ | ||
=== Step 3 === | === Step 3 === | ||
- | Declare | + | Declare |
<code c> | <code c> | ||
- | static Adafruit_LiquidCrystal | + | LiquidCrystal |
</ | </ | ||
Line 53: | Line 48: | ||
Initialise class with display area configuration (number of columns, here 16 and rows, here 2): | Initialise class with display area configuration (number of columns, here 16 and rows, here 2): | ||
<code c> | <code c> | ||
- | lcd.begin(16, | + | lcd.begin(16, |
</ | </ | ||
Line 61: | Line 56: | ||
* '' | * '' | ||
* '' | * '' | ||
+ | |||
+ | A simple example can be the Hello World: | ||
+ | <code c> | ||
+ | lcd.print(" | ||
+ | </ | ||
==== Result validation ==== | ==== Result validation ==== |