Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

(a) Many microcontroller designs use hardware timers. (i) Briefly explain why ha

ID: 2082357 • Letter: #

Question

(a) Many microcontroller designs use hardware timers. (i) Briefly explain why hardware timers are useful in MCUs. (ii) Explain the operation of a Watchdog Timer. (b) A machine counts envelopes which are being packaged in packs of 200. The machine is controlled by a PIC 16F887 microcontroller. A sensor connected to the RA4/T0CKI pin produces a logic pulse every time envelope passes it. A block diagram of the Timer 0 and T0CON (Timer 0 control register) is given in Figure Q4 (b). (i) Describe how you would configure the TMR0 to count the envelopes. Indicate what value you would set in the Option Register. (ii) Explain what strategy could be used to allow the microcontroller program to detect when the number 200 had been reached. (c) In another application also using PIC 16F887 microcontroller, a regular timed interrupt is required. The clock oscillator frequency is 20 MHz, and an interrupt frequency in the region of every 2ms is required. Describe how you would now configure the TMR0 module if an interrupt frequency in the region of every 2ms is required.

Explanation / Answer

A-i In the software timer it uses delay loop method, which waste the time of MCU. During the time the loop performs it's action, many instructions could have been completed by MCU. So the hardware timer prove to be more efficient , as it uses external timer to provide a delay. Hence it saves MCU time and provide high speed.

ii- A watchdog timer is external or hardware timer which is used to reset the system if the fault occurs during the execution of programs or any other fault. If the system could not automatically reset itself and hangs in between a watchdog timer reset it after it counts to a preset value. If the main loop is working perfectly then after every loop the watchdog timer resets and again counts till the preset value, which is often set to the abnormal conditions.