Arduino/C3/Interfacing-LCD-through-AVR-GCC-programming/English-timed
Time | Narration |
00:01 | Welcome to the Spoken Tutorial on Interfacing LCD through AVR-GCC programming. |
00:09 | In this tutorial, we will learn to:
interface a LCD to Arduino board, write an AVR-GCC program to display a digit on LCD. |
00:22 | To follow this tutorial, you should have basic knowledge of :
electronics, C Programming and AVR-GCC. |
00:34 | To record this tutorial, I am using:
Arduino UNO Board, Ubuntu Linux operating system version 14.04. |
00:47 | We also require some external devices such as:
Breadboard, LCD 16 by 2, Arduino UNO Board, |
01:00 | Potentiometer,
Jumper Wires and Pin headers. |
01:07 | In this experiment, we will be using a 16 by 2 LCD.
Please refer to the basic level tutorials of this series to know more about LCD. |
01:20 | Make use of the given table to connect the Arduino pins to the LCD. |
01:26 | This table is available in the Additional reading material link of this tutorial. |
01:32 | This is the circuit connection. |
01:35 | Connect one extreme lead of the potentiometer to pin 1 of the LCD. |
01:42 | The other extreme end is connected to pin 2 of the LCD.
The middle pin is connected to pin 3 of the LCD. |
01:53 | This is the live setup of the connection. |
01:58 | Now, we will write an AVR-GCC program to display the digit 5 on the LCD. |
02:05 | Open any text editor and type the following. |
02:09 | avr/io.h contains all the basic libraries required to perform the input and output operations. |
02:19 | Util slash delay.h contains the libraries for the delay function. |
02:26 | stdlib.h contains the libraries for defining variable types and other commonly used functions. |
02:36 | ClearBit(x comma y) is equivalent to cbi(x comma y). This is used to clear the yth bit of PORTx. |
02:47 | SetBit(x comma y) is equivalent to sbi(x comma y). This is used to set the yth bit of PORTx. |
02:58 | All the numerical pins of the LCD are replaced with the names using hash define. |
03:05 | This is done to make the program easier to understand. |
03:10 | The PulseEnableLine function is used to toggle the enable pin of the LCD. |
03:17 | SetBit will set to high and Clearbit will set to low, with a delay in between. |
03:25 | The SendNibble function is used to send data of one nibble to the PORTB. |
03:33 | The SendByte function is used to send data of one byte to the PORTB. |
03:40 | The LCD underscore Cmd function is used to send a command to the LCD. |
03:47 | The LCD underscore Char function is used to send a character data to the LCD. |
03:55 | The LCD underscore Init function is used to initialize the LCD. |
04:02 | The LCD underscore Clear function is used to clear the display. |
04:09 | The LCD underscore Message function is used to send a string of data to be displayed on the LCD. |
04:18 | The LCD underscore Integer function is used to send an integer data to the LCD. |
04:27 | This is the main function where we pass the value 5 to the display. |
04:33 | This code is available in the Code files link of this tutorial. You can download and use it. |
04:41 | I’ll save the code as lcd.c file in the Downloads folder.
Ensure that the Makefile is also present in the same folder. |
04:53 | Switch to the terminal. |
04:56 | Go to the folder where lcd.c file is saved.
Type: make space FNAME in capital = lcd and press Enter. |
05:12 | This command creates a .hex file and uploads it to Arduino. |
05:18 | Now, you can see that the digit 5 is displayed on the LCD. |
05:25 | This brings us to the end of this tutorial. Let us summarize. |
05:31 | In this tutorial, we learnt to:
interface a LCD to Arduino board and write an AVR-GCC program to display a digit on LCD. |
05:43 | As an assignment-
Modify the above code to display any other digit from 0-9. Modify the above code to build a counter which counts from 0 to 9. |
05:57 | The video at the following link summarizes the Spoken Tutorial project. Please download and watch it. |
06:05 | The Spoken Tutorial Project team:
conducts workshops and gives certificates. For more details, please write to us. |
06:15 | Please post your timed queries in this forum. |
06:19 | Spoken Tutorial project is funded by NMEICT, MHRD, Government of India. More information on this mission is available at this link. |
06:29 | This tutorial has been contributed by FOSSEE and Spoken Tutorial Project, IIT Bombay.
This is Priya from IIT Bombay, signing off. Thanks for watching. |