Can someone help solve these two problems regarding Microcontrollers and Micropr
ID: 2078971 • Letter: C
Question
Can someone help solve these two problems regarding Microcontrollers and Microprocessors class:
1) An engine designer for sports cars requires an 16 MHz (= reference frequency) oscillator for certain engine timing functions. However, to meet the stringent timing requirements, the oscillator or resonator frequency can deviate no more than 6 kHz from the reference frequency. What is the performance of the required oscillator in % and PPM?
2) Given a complete sequential program without any branches (no GOTO and CALL statements) that consists of 14,613 instructions and a PIC microcontroller that is connected to a 8.0 MHz external clock/oscillator, determine how long it would take this microcontroller to execute the 14,613 instructions. (assume the first instruction starts at 0x0000 in program memory)
Explanation / Answer
1. Performance of the oscillator in %:
Frequency Max deviation
16X10e6 6X10e3
100 ?
= 100 x 6X 10e3/ ( 16x10e6 ) = 0.0375 %
16MHz +/- 0.0375%
Performance of the oscillator in ppm:
Frequency Max deviation
16X10e6 6X10e3
10e6 ?
= 10e6 X 6X10e3/(16X10ê6) = 375ppm
16MHz +/- 375 ppm
2. Each instruction cycle in PIC microcontroller takes 4 clock cycles ( except for branching instructions ).
Since there are no branching instructions in this program, each one of the instructions in this program take 4 clock cycles.
Total instructions = 14613
Therefore total clock cycles: 14613 X 4 clock cycles.
The microcontroller is connected to 8MHz clock. Hence one clock cycle = 1/ 8 uS = 0.125 uS
Therefore the total time taken would be: 14613 X 4 X 0.125 uS = 7306.5 uS = 7.3 mS