Edudorm Facebook

liquid crystal display (LCD)

Laboratory Practical three: liquid crystal display (LCD)

            Laboratory objective

In the laboratory there is the presence of LCD component availability. This is an industrial customary LCD 2*16 that is influenced by a dedicated driver.  A single LCD can accomplish numerous functions like characters display, numerical values display as well as animations with the utilisation of LCD custom library.

Exercise One:  Demonstration of the LCD Library Custom

Objective of the Exercise

To accumulate a provided package in order to view the LCD libraries functions working in the specific program.

Procedure

One of the jobs for the project development for the section of LCD was generally to engage customised LCD files in the whole project and this has been accomplished by the created project. Based on the code study there is a clear demonstration that the project operations through the flow chart below.

 

 

 

 

 

 

       
     
 
   

 

 

 

 

 

 

 

 

 

 

 

 

 

The project’s code is:

// Filename: Lab3Ex1.c

// Version: 1.0

// Date:

// Author:

// Description: Simple demonstration of the LCD custom library functions

#define _XTAL_FREQ 3276800 // This tells the compiler that the 16F877A

// is clocked at 3.2768 MHz. Required by the

// __delay_ms macro.

#include <xc.h> // Required for all MPLAB XC8 source files

#include "LCDdrive.h" // Header file needed to access to LCD custom

// library

void main(void)

{

char myString[] = {"Embedded Systems"}; // Initialise an array with a string

unsigned short i; // Indexing variable

LCD_initialise(); // Initialise the LCD ready for use

LCD_puts(myString); // Display the myString string

LCD_cursor(0,1); // Move the cursor to the 2nd line

LCD_cursor_on(); // Turn flashing cursor ON

// Illustration of the putch() function

__delay_ms(2000); // Wait 2 seconds

LCD_putch('A'); // Print character A

__delay_ms(2000); // Wait 2 seconds

LCD_putch('B'); // Print character B

__delay_ms(2000); // Wait 2 seconds

LCD_putch('C'); // Print character C

__delay_ms(2000); // Wait 2 seconds

LCD_cursor_off(); // Turn flashing cursor OFF

for (i=0; i<1000; i++) // Set up loop to display counting numerals

{

LCD_cursor(4,1); // Move the cursor to the column 4 on the 2nd line

LCD_display_value(i); // Display the value of x at the cursor position

__delay_ms(100); // Short delay

}

}

The primary sections are;

Showing mathematical value

for (i=0; i<1000; i++) // Set up loop to display counting numerals

{

LCD_cursor(4,1); // Move the cursor to the column 4 on the 2nd line

LCD_display_value(i); // Display the value of x at the cursor position

__delay_ms(100); // Short delay

}

 

An irregular cursor

LCD_cursor_on(); // Turn flashing cursor ON

Printing of separable characters

__delay_ms(2000); // Wait 2 seconds

LCD_putch('A'); // Print character A

__delay_ms(2000); // Wait 2 seconds

LCD_putch('B'); // Print character B

__delay_ms(2000); // Wait 2 seconds

LCD_putch('C'); // Print character C

__delay_ms(2000); // Wait 2 seconds

 

Production of a string

LCD_initialise(); // Initialise the LCD ready for use

LCD_puts(myString); // Display the myString string

 

Outcome

            The uploaded program performed through the demonstration of roles that had been designed and developed for the particular exercise. The context is demonstrated on the LCD and the delay of characters is displayed after   each two seconds. The characters of the messages are them demonstrated at a hundred milliseconds delay. The program designed worked correctly based on the expectation.

Conclusion

Through the particular program LCD custom build libraries demonstration has been received.

Exercise Two: LCD display Animation

Objective of the Exercise

 Through the utilization of LCD library roles animation is to be generated.

Process

The program’s given code has been compiled and indicated below

// Filename: Lab3Ex2.c

// Version: 1.0

// Date:

// Author:

// Description: Simple animation using the LCD custom library functions

#define _XTAL_FREQ 3276800 // This tells the compiler that the 16F877A

// is clocked at 3.2768 MHz. Required by the

// __delay_ms macro.

#include <xc.h> // Required for all MPLAB XC8 source files

#include "LCDdrive.h" // Header file needed to access the LCD custom

// library

void main(void)

{

char myString[] = {"LCDs are great"}; // Initialise an array with a string

unsigned short i; // Indexing variable

LCD_initialise(); // Initialise the LCD ready for use

LCD_puts(myString); // Display the myString string

while(1) // Infinite loop

{

for (i=0; i<16; i++) // Set up loop to move character

{

LCD_cursor(i,1); // Move cursor into position

LCD_putch('O'); // Display character

__delay_ms(200); // Short delay

LCD_cursor(i,1); // Move the cursor back to original position

LCD_putch(' '); // Erase character

}

}

}

 

The sequencer flow chart imitated from the clarification and education of the code is provided below:

 

 

 

 

 

 

 

 

 

 

            The particular program was structured so that the animation can move to the LCD right side of the screen and after reaching the final step the directions   are transformed.  The primary program’s added code has thus been indicated:

// Filename: Lab3Ex2.c

// Version: 1.0

// Date:

// Author:

// Description: This part has been done to bring the character back

#define _XTAL_FREQ 3276800 // This tells the compiler that the 16F877A

// is clocked at 3.2768 MHz. Required by the

// __delay_ms macro.

#include <xc.h> // Required for all MPLAB XC8 source files

#include "LCDdrive.h" // Header file needed to access the LCD custom

// library

void main(void)

{

char myString[] = {"LCDs are great"}; // Initialise an array with a string

unsigned short i; // Indexing variable

LCD_initialise(); // Initialise the LCD ready for use

LCD_puts(myString); // Display the myString string

while(1) // Infinite loop

{

for (i=0; i<16; i++) // Set up loop to move character

{

LCD_cursor(i,1); // Move cursor into position

LCD_putch('O'); // Display character

__delay_ms(200); // Short delay

LCD_cursor(i,1); // Move the cursor back to original position

LCD_putch(' '); // Erase character

}

for (i=15; i>0; i--) // Set up loop to move character

{

LCD_cursor(i,1); // Move cursor into position

LCD_putch('O'); // Display character

__delay_ms(200); // Short delay

LCD_cursor(i,1); // Move the cursor back to original position

LCD_putch(' '); // Erase character

}

}

}

            Outcome

The program that was uploaded performed through the demonstration of the string as well as animation running movement.  The structured code then worked in ensuring that the animation running changed after reaching their last level destination.

Conclusion

A complete animation running program has been developed through the utilization of the functions of LCD.

 

Exercise Three: numerical information Display

Objective of the exercise

The primary aim  of this particular exercise  is to gain  the capability  of  developing a program that  can effectively sort odd  numbers that exists amid 1 and 99  followed by  displaying  them on the LCD with a period  delay  of 0.5 seconds  between every update.

Procedure

This program was initially designed to establish how   to detect odd numbers with the use of a program. This can thus be accomplished with the use of an ease division that utilizes division 2.  In order to identify the odd numbers they will be characterized with remainders while the even ones will not thus detecting the odd numeric.

Code:

// Filename: Lab3Ex3.c

// Version: 1.0

// Date:

// Author:

// Description: Display of the odd numbers between 1-99

#define _XTAL_FREQ 3276800 // This tells the compiler that the 16F877A

// is clocked at 3.2768 MHz. Required by the

// __delay_ms macro.

#include <xc.h> // Required for all MPLAB XC8 source files

#include "LCDdrive.h" // Header file needed to access to LCD custom

// library

void main(void)

{

unsigned short i; // Indexing variable

LCD_initialise(); // Initialise the LCD ready for use

 

for (i=1; i<100; i++) // Set up loop to display counting numerals

{

if (i % 2)

{

    LCD_cursor(0,1);

    LCD_display_value(i); // Display the value of i at the cursor position

     __delay_ms(500);

} // Short delay

else

{

__delay_ms(500); // Short delay

}

}

}

Flow chart:

       
     
 
   

 

 

 

 

 

 

 

 

 

 

 

 

 

            Outcome

This specific program correctly demonstrates all the odd numbers that exist amid one and ninety nine by showing them with a period delay of 0.5 seconds on the screen of LCD.

Conclusion

The necessary program has been designed, developed and tested efficiently.

 

1339 Words  4 Pages
Get in Touch

If you have any questions or suggestions, please feel free to inform us and we will gladly take care of it.

Email us at support@edudorm.com Discounts

LOGIN
Busy loading action
  Working. Please Wait...