upc eetac_1


Project P11: Adding ASCII messages


Peripherals: LCD display

1. Specifications

 Enhance the P10 project adding a standard LCD display to represent ASCII messages on the two-lines 16-character screen. Information can be about the internal state, for example: "Click ST button to start the sequence", "State: Num 0", "Click ST button to stop", etc.


Fig 1. The common LCD display LM032L. The LCD controller is the standard Hitachi HD44780 (Dot Matrix Liquid Crystal Display Controller/Driver) or equivalent like the HD44100.


Follow the discussion in class to fully understand these specifications and be able to infer a plan. 

Learning materials and tutorials:

Study carefully these tutorials and run them in Proteus to see how the system works, and can be programmed taken advantage of all your previous knowledge.

- This is a circuit based on the PIC18F4520 microcontroller that uses a library of LCD functions.  Here you are a very good link to read more on the subject.

- Alternatively, when installing the PLIBS for the XC8 compiler you have access to a variety of peripheral libraries that includes the XLCD.  Try this example circuit where all the required functions and headers from the PLIBs are copied in the project folder and so you can compile and run it.

LCD display

Fig 2. Using the 8th bit of the PORT where the LCD is connected you can switch ON and OFF the LCD.

- These are Internet references (1) (2) (3) with different sets of high-level C functions to interface the LCD display. This example  (PIC16F877A, XC8) is copied  from (1). Thus, you can integrate these libraries into your project and use the LCD functions.

- This is an example (PIC16F877A, XC8) that you can study and learn about what is necessary to use the LCD. The functions were integrated in the old HI-TECH C compiler which is no longer in use. 

- This is an example using ATmega8535 from the former Unit 4.11. And here is the same example slightly modified to be able to write in both rows of the LCD display.


2. Planning

1) Project locations and file names. In Fig. 3 is an example list of source files when using the libraries from the example above (PIC16F877A) and copying and renaming the P10 source file as LCD_Display.c.


Fig. 3. Example of a typical project that includes LCD libraries.

2) Organise the hardware. Draw your circuit in a sheet of paper and discuss where to connect: reset (CD), CLK oscillator, digital I/O and push-buttons. A good idea is to connect inputs and outputs in the free pins of a development board like the PICDEM2 Plus, in case you would like to prototype the application. In this board, the LCD display is connected to the microcontroller's PORTD.

3) Determine which functions in the main program have to be modified in order to control the LCD display. Define the RAM internal variables that will facilitate the communication to the LCD. Use a convenient indicator like LCD_flag to not to write continuously to the display, but only when new information has to be presented.

4) Plan a sequence for building and debugging the application: the idea is "plan & develop & test" step by step enhancing the initial state diagram with a new features at a time. For instance:

(1) Run the P10 and try to print only the typical ASCII message "Hello World" on the LCD.

(2) Add now the messages you like in each FSM state.

3. Development

1) Draw the schematic of the application in Proteus copying the P10 and modifying it so that the LCD is made visible on the top schematic.


Fig. 4. The LCD to represent ASCII  messages.

2) Run the microcontroller's IDE to develop and compile the C code copying and adapting the previous P10 code. Do it section by section according to your plan, testing if it works before adding new code.


4. Testing 

 Run the Proteus simulator. Do it in step by step mode while watching variables and placing break points, specially to follow the interrupt flags.


Fig. 4. 


5. Report

This is a page with some guidelines on project oral presentations and written reports. 


6. Prototyping

You're invited to download the application to a given training board an verify that it works as expected and the same as in the simulator.


Other similar projects on sequential circuits

Books, web pages, etc.

- The LCD interface is solved everywhere for many microcontroller environments.  

- Exams, questions, and problems


Other materials of interest

Books, web pages, etc.

- The datasheet of the Hitachi chip used in to control simple LCD displays.