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

 

Timer 18.5 s. Design phase #4: TMR2 time-base

P12


Dedicated processor (FSM+datapath), peripherals LCD and TMR2

1. Specifications

Design a fixed-time timer (for instance 18.5 s) as an enhancement of the design phase #3 replacing TMR0 by TMR2. 

Symbol

Fig. 1.Project entity is the same in phase #2 but supressing external CLK.

Common features:

- The same features as in project design phase #1 Timer, phase #2 Timer_LCD, and phase #3 Timer_LCD_TMR0 all of them proposed as the tutorial to be discussed in Lab11.

- TMR2 peripheral to generate  20 ms time-base replacing TMR0.

- Optional: Add a buzzer that will sound for 2 s at 1 kHz once the timing period has ended.

 

2. Planning

A) Planning hardware

If the optional buzzer is added it may wired at RC2 as it is in PICDEM2plus board.

Timer LCD TMR2

Fig. 2. Electronic schematic.

Study how the TMR2 works, its configuration bits and interrupt mechanism. How to add a software postscaler variable to generate long counts? 

http://digsys.upc.edu/ed/CSD/units/Ch4/U4_14/img9.jpg

Fig 3. Hardware components (a kind of RTL view) of the TMR2 of the Microchip PIC18F4520.

 


B) Planning software 

It is the same design presented in phase #3 but replacing TMR0 by TMR2. The design equation for generation timing periods TP is slightly modified. TMR2 contains a postscaler circuit as well.

TMR2

Fig. 4. Parameters fr adjusting TMR2.

Project location:

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

 

3. Developing and 4. Testing the design using EDA tools

A) Developing hardware

This is an example electronic circuit Timer_LCD_TMR2.pdsprj. It is the same as in design phase #3 because we are simply replacing internal peripherals TMR0 by TMR2.


B) Developing software

This is an example C source code Timer_LCD_TMR2.c to be compiled at the same time with LCD library files.


C) Step-by-step testing

The circuit running is captured in Fig. 5.

Circuit  

Fig. 5. Picture of the same timer representing and udating time every tenth of a second.

 

5. Report

Project report starting with the template sheets of paper, scanned figures, file listings, docx , pptx, or any other resources.

 

6. Prototyping

Use training boards and perform measurements to verify how the circuit works for real in laboratory.

Add the buzzer to sound the alarm when the timing period has finished. What king of modifications are required?