8. How to add a LCD Peripheral?
Double click LiquidCrystal.c file and change line 10 to stm32l0xx_hal.h
*Note: The letter is small L, not 1 in 32l0.
Next, go to line 180 and comment out line 180 & 181.
*Note: The GPIOF is commented out as it does not exist in our case.
Next, we need to include paths for the LCD files. First, go to Project > Options for Target.
Next, go to C/C++ (AC6) tab and click ... under the Include Paths.
Next, click on the New (Insert) button followed by the... button.
Next, select the src folder inside of the STM32LiquidCrystal folder and click OK.
Next, go to main.c file and add in #include "LiquidCrystal.h" on line 26 under private includes.
Next, we will initialize the LCD with the pins defined earlier. Go to line 89 and add in the following or simply copy paste the code below.
|
*Note: Edit your own message to be printed on the start up of the LCD Display.
Finally, rebuild all target files, load the code into the 1SJ Board and press the reset button. Your message should appear on the LCD display.