upc eetac_1

Week 11

Week 12: Timers and other peripherals

Planning



[16/12]

Laboratory #12

[P12] Handling several interrupts TMR0IF and INT0IF

Analysis of an application based on timers: a timer of 18.5 s

 

1. Specifications.

2. Planning:

2.1 Hardware circuit

2.2.- Software planning.  State diagram. Variables. CC2 truth table and flow chart. CC1 truth table and flow chart.


3. Development and 4. Test. Let's complete the example amb introduce modifications. 

Run the tutorial timer for 18.5 s. Analyse hardware connections and the important C code sections so that you can write your diagrams and flow charts. Init_system(), read_inputs(), state_logic(), output_logic(), write_outputs() and the interrupt service routine ISR().  Complete in full detail the application block diagram based on a FSM + datapath. Observe the use of the LCD instructions.

Modify the circuit and the parameters to generate a 2.23 s timer using the Timer0.

 


[17/12]

Lecture #12

[P12] Timer1, Timer2 and other peripherals.

Microcontroller applications

 

Questionnaire #Q3.1 on P9-P10-P11-P12. 

Presenting another application. The idea of the P12 project: Enhancing the Johnson counter FSM by means of: (1)  the external CLK source (INT0), or (2) an internal (Timer2). The idea of saving power and PCB space using internal peripherals (timer) instead of external chips (CLK oscillator). 

Another example using the Timer 2. Solve the 2.23 s timer using the Timer2 in the datapath. Compare it with the version solved using Timer 0. 

Timer1 and the external 32.768 kHz crystal CLK. The real-time for a huge range of applications.

  


Configuring timers 1 and 2 to measure the frequency or the period of an external signal. Counting number of vehicles in a road, speed of a bicycle, distance to a wall using an ultrasonic sensor, etc.

Analyse and run this example project #15 in the P_Ch3 project list on a bicycle speed meter (the basics on cyclocomputers).  How to add a new feature like an odometer up to riding distance of 1000 km ?

 

5 min. for answering the UPC questionnaire.

Example problems using more peripherals. A/D, Asynchronous serial port (USART), Synchronous bus (I2C), etc.

 


[19/12]

Guided activities #12

[P12] Microcontroller applications

 

 

Final class on questions & answers on the diffferent projects proposed.

Final examples on microcontroller applications. What kind of project can you attain after this course content?

Other microcontroller or computer platforms such as Arduino or Raspberry Pi.  Specialised transducers: sensors and actuators.

Example of designing a weather station (bachelor thesis TFG (1) (2).