You are on page 1of 12

Activity No.

4
MICROCONTROLLER DISPLAY
Course Code: CPE 006 Program:ECE
Course Title:Microprocessor Systems Date Performed:1/20/2020
Section:EC42FA1 Date Submitted:1/27/2020
Name/s: Instructor:

1. Objective:
This activity aims to demonstrate the function of Liquid Crystal Display devices on microprocessor-
based systems including text display, cursor movement, among others.

2. Intended Learning Outcomes (ILOs):


After completion of this activity the students should be able to:
1. Write a code for a microprocessor-based system that uses an LCD
2. Build a circuit which displays sensor input data and its results to an LCD device.
3. Discussion:
We all know that nowadays we are using more technical and that is with the use of microcontroller.
Microcontrollers are reusable, dependable, cost effective, and energy efficient. need for skilled programmers and the
sensitivity of the controllers to electrostatic charges.Microcontroller has dedicated input device and often has a small
LED or LCD display for output. It mentioned about the output of it where it may either LED or LCD display but on this
experiment focuses about LCD display.

As mentioned, the output may either LED or LCD display on this activity focuses on display.
Microcontrollers have a few display options available. An LCD is a common, low-cost option that uses a backlight
made of either cold-cathode fluorescent tubes. CCFL or LED which refers to an LCD display with LED backlight.
Lastly, the OLED which emits light in a manner similar to LEDs and therefore does not require a separate backlight.

On this activity, from the different display options LCD was the one used as the display. A LCD or Liquid
Crystal Display is a flat-panel display or other electronically modulated optical device that uses the light-modulating
properties of liquid crystals combined with polarizers. LCD uses a liquid crystal to produce a visible image. Liquid
crystal displays are super-thin technology display screen. A 16x12 LCD screen is most likely used in Arduino where
16×2 LCD display is a very basic module commonly used in circuits. The 16×2 translates o a display 16 characters
per line in 2 such lines. In this LCD each character is displayed in a 5×7pixel matrix.

LCD is important is important because can be disposed of more safely than a CRT can. Its low electrical
power consumption enables it to be used in battery-powered electronic equipment more efficiently than CRTs can
be.

4. Resources Needed:
4.1 Desktop Computer
4.2 Arduino Software
4.3 Breadboard
4.4 Connecting Wires
4.5 Potentiometer
4.6 Resistor
4.7 Liquid Crystal Display
5. Procedures:

Activity 1 – LCD Print


1. Connect the Arduino to the computer using USB cable type and look for the Arduino software
on your desktop.
2. Start writing your code in the Sketch Writing Area.

3. In this activity, we are asked to write a code that displays “hello, world!” in the LCD Screen. For
the source code, follow the flowchart below.
4. After writing the source code, click the compile button from the toolbar to verify for any error in
the code.

5. Then, to upload your code to the Arduino click the upload button beside the compile button in
the toolbar.

6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.

Activity 2 – LCD Print with Counter


1. Connect the Arduino to the computer using USB cable type and look for the Arduino software
on your desktop.
2. Start writing your code in the Sketch Writing Area.
3. In this activity, we are asked to write a code that displays “hello, world!” with a counter. For the
source code, follow the flowchart below.

4. After writing the source code, click the compile button from the toolbar to verify for any error in
the code.
5. Then, to upload your code to the Arduino click the upload button beside the compile button in
the toolbar.

6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.

Activity 3 – LCD Print with Counter Moving


1. Connect the Arduino to the computer using USB cable type and look for the Arduino software
on your desktop.
2. Start writing your code in the Sketch Writing Area.
3. In this activity, we are asked to write a code that displays “hello, world!” with a counter that is
moving. For the source code, follow the flowchart below.

4. After writing the source code, click the compile button from the toolbar to verify for any error in
the code.
5. Then, to upload your code to the Arduino click the upload button beside the compile button in
the toolbar.

6. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.

Activity 4 – LCD Print Character Display


1. Connect the Arduino to the computer using USB cable type and look for the Arduino software
on your desktop.
2. Start writing your code in the Sketch Writing Area.
3. In this activity, we are asked to write a code that displays a character. For the source code,
follow the flowchart below.
1. After writing the source code, click the compile button from the toolbar to verify for any error in
the code.
2. Then, to upload your code to the Arduino click the upload button beside the compile button in
the toolbar.

3. After uploading your code, follow the circuit diagram below to connect your Arduino to your
breadboard.
6. Results

Activity 1 – LCD Print

#include <LiquidCrystal.h>

constintrs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;


LiquidCrystallcd(rs, en, d4, d5, d6, d7);

void setup() {
  lcd.begin(16, 2);
  lcd.print("hello, world!");
}

void loop() {
  lcd.setCursor(0, 1);
  lcd.print(millis() / 1000);
}
Activity 2 – LCD Print with Counter

#include <LiquidCrystal.h>

constintrs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;


LiquidCrystallcd(rs, en, d4, d5, d6, d7);

void setup() {
  lcd.begin(16, 2);
  lcd.print("hello, world!");
}

void loop() {
  lcd.setCursor(5, 1);
  lcd.print(millis() / 1000);
}

Activity 3 – LCD Print with Counter Moving

#include <LiquidCrystal.h>

constintrs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;


LiquidCrystallcd(rs, en, d4, d5, d6, d7);

void setup() {
  lcd.begin(16, 2);
  lcd.print("hello, world!");
  delay(1000);
}

void loop() {
  for (intpositionCounter = 0; positionCounter< 13; positionCounter++) {
    lcd.scrollDisplayLeft();
    delay(150);
  }

  for (intpositionCounter = 0; positionCounter< 29; positionCounter++) {


    lcd.scrollDisplayRight();
    delay(150);
  }

  for (intpositionCounter = 0; positionCounter< 16; positionCounter++) {


    lcd.scrollDisplayLeft();
    delay(150);
  }
delay(1000);

Activity 4 – LCD Print Character Display

#include <LiquidCrystal.h>

LiquidCrystallcd(12, 11, 5, 4, 3, 2);


byte customChar[8] = {
0b00110,
0b01001,
0b01001,
0b00110,
0b00000,
0b00000,
0b00000,
0b00000
};

void setup()
{
  lcd.createChar(0, customChar);
  lcd.begin(16, 2);
  lcd.write((uint8_t)0);
 }

void loop() {
}

TEST RESULTS
ACTIVITY 2

ACTIVITY 3

ACTIVITY 4
7. Observations:

In this experiment, we observed that the LiquidCrystal library allows you to control LCD displays that are
compatible with the Hitachi HD44780 driver. The process of controlling the display involves putting the data
that form the image of what you want to display into the data registers, then putting instructions in the
instruction register. The LiquidCrystal Library simplifies this for you so you don't need to know the low-level
instructions.

8. Conclusions:
As you can see, the first part of the code includes the “LiquidCrystal” library that includes the LCD interface
functions. It then defines pins 12, 11, 5, 4, 3, and 2 of the Arduino as the pins that are interfacing with the
LCD screen. Remember, pins 2-5 control the display data signal pins, while pins 12 and 11 control RS and
Enable pins respectively. The program then defines the size of the LCD connected (In this case a 16x2
display) with the lcd.begin function. With the lcd.print function, the text string “Hello World” is then printed to
the screen. As you can see, the cursor that determines where the text begins can be set with the
lcd.setCursor function. The Arduino has a built in function that can count the number of milliseconds since
the program began to run. With the final lcd.print function, the Arduino is displaying every second that
passes on the screen.

9. References:
https://www.microcontrollertips.com/display-options-mcus-lcd-led-oled/
https://www.slideshare.net/BilalMaqbool3/advantages-and-disadvantages-of-lcd
https://techterms.com/definition/lcd
https://en.wikipedia.org/wiki/Liquid-crystal_display

10. Assessment (Rubric for Laboratory Performance):

You might also like