UPC EETAC Bachelor's Degree in Telecommunications Systems and in Network Engineering EEL

 

Timer. Phase #2: timer + LCD 

P10 - P11 - P12

Lab 11


External peripherals

1. Specifications Planning Dev. & test Prototype report

Continue the design of the fixed-time Timer (for instance 18.5 s) adding an LCD screen for representing information, ASCII messages (text and numerical data) on the screen. The symbol is represented in Fig. 1.

Symbol Waveforms

Fig. 1. The timer symbol and basic waveform in non-retriggerable mode of operation.

Features:

- Same features as in design phase #1 Timer above.

- Organise the solution in two steps:

- Step #1 information may be simply ASCII messages, "Hello World"

- Step #2 information may include dynamic data such time in seconds while down counting.

 


Specifications 2. Planning Dev. & test Prototype report

A) Planning hardware

The LCD interface is copied from the example in P11. Only six wires are required: D(7..4) for the data bus, LCD_E and LCD_RS to send instructions or data.

LCD display

Fig. 2. The LCD interface used in our CSD_PICstick board can be replicated in Proteus.

In this way the hardware schematic is presented in Fig. 3.

Electronic circuit

Fig. 3. Electronic circuit sketch. 

 


B) Planning software

Draw the hardware-software diagram. Discuss how the state diagram is modified to adapt the LCD. What new signals are required? What is var_LCD_flag?

HArdware_software diagram

Fig. 4. Hardware-software diagram is the same as in design phase #1 adding the LCD interface connected to output_logic() function.

 Modify init_system() function.

Picture

Fig. 5. Adaptation in init_system().

 Modify state-logic() and output_logic(). Truth tables and flowcharts.  

Picture

Fig. 6. Adaptations in state-logic() and output_logic().

  


Project location:

C:\CSD\P12\Timer_LCD\(files)

 


Specifications Planning 3. Dev. & 4. test Prototype report

We will start copying the previous files from design phase #1 in the new folder location changing their names. We will compile and run the simulations to check that everything works before adding the LCD code introducing and changing their names.

A) Developing hardware

Include LCD display. This is an example "Timer_LCD.pdsprj" hardware.

Circuit in Proteus

Fig. 7. Circuit captured in Proteus.

 


B) Developing software

The XC8 compiler version is v3.0 or newer, C standard is C99. And these LCD library files "lcd.c", "lcd.h" has to be included in the project. The file "config.h" contains all the microcontroller configuration bits. This is an example source file containing the LCD adaptations "Timer_LCD.c". Generate the executable (*.hex) and debugging files (*.cof).

 


C) Step-by-step testing

Fig. 8 shows the circuit running representing ASCII characters on the LCD screen.

Circuit running

Fig. 8. Timer with LCD running.

The idea is for easy debugging, write, compile and run a bit of code with both windows working interactively: hardware Proteus environment and software IDE. Use the watch window and break points to stop and control the program sequence and monitor RAM variables of interest for each function.

Circuit running with watch window

Fig. 9. The timer running while watching the software main variables.

 


Specifications Planning Dev. & Test 5. Prototype Report

Example 1: Board CSD_PICstick . Target microcontroller: PIC18F46K22. Tools: MPLAB X + XC8 + Proteus + VB8012 compact instrumentation.  

For this first experiment we can connect the LCD through the 40-pin flat cable and the prototype board or only the six individual female-male wires.

 


Specifications Planning Dev. & Test Prototype 6. Report

Follow this rubric for writing reports.