21.08.2013 Views

Embedded Systems Design with the Atmel AVR Microcontroller Part II

Embedded Systems Design with the Atmel AVR Microcontroller Part II

Embedded Systems Design with the Atmel AVR Microcontroller Part II

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

6.13. CHAPTER PROBLEMS 179<br />

and considered some applications where <strong>the</strong> timer subsystem of a microcontroller can be used. We<br />

<strong>the</strong>n took a detailed look at <strong>the</strong> timer subsystem aboard <strong>the</strong> ATmega164 and reviewed <strong>the</strong> features,<br />

operation, registers, and programming of <strong>the</strong> three timer channels. We concluded <strong>with</strong> examples<br />

employing a servo motor and an automated fan cooling system.<br />

6.13 CHAPTER PROBLEMS<br />

6.1. Given an 8 bit free running counter and <strong>the</strong> system clock rate of 24 MHz, find <strong>the</strong> time<br />

required for <strong>the</strong> counter to count from zero to its maximum value.<br />

6.2. If we desire to generate periodic signals <strong>with</strong> periods ranging from 125 nanoseconds to<br />

500 microseconds, what is <strong>the</strong> minimum frequency of <strong>the</strong> system clock?<br />

6.3. Describe how you can compute <strong>the</strong> period of an incoming signal <strong>with</strong> varying duty cycles.<br />

6.4. Describe how one can generate an aperiodic pulse <strong>with</strong> a pulse width of 2 minutes.<br />

6.5. Program <strong>the</strong> output compare system of <strong>the</strong> ATmega164 to generate a 1 kHz signal <strong>with</strong> a<br />

10 percent duty cycle.<br />

6.6. <strong>Design</strong> a microcontroller system to control a sprinkler controller that performs <strong>the</strong> following<br />

tasks. We assume that your microcontroller runs <strong>with</strong> 10 MHz clock, and it has a 16 bit free<br />

running counter. The sprinkler controller system controls two different zones by turning<br />

sprinklers <strong>with</strong>in each zone on and off. To turn on <strong>the</strong> sprinklers of a zone, <strong>the</strong> controller<br />

needs to receive a 152.589 Hz PWM signal from your microcontroller. To turn off <strong>the</strong><br />

sprinklers of <strong>the</strong> same zone, <strong>the</strong> controller needs to receive <strong>the</strong> PWM signal <strong>with</strong> a different<br />

duty cycle.<br />

6.7. Your microcontroller needs to provide <strong>the</strong> PWM signal <strong>with</strong> 10% duty cycle for 10 millisecond<br />

to turn on <strong>the</strong> sprinklers in zone one.<br />

6.8. After 15 minutes, your microcontroller must send <strong>the</strong> PWM signal <strong>with</strong> 15% duty cycle<br />

for 10 millisecond to turn off <strong>the</strong> sprinklers in zone one.<br />

6.9. After 15 minutes, your microcontroller must send <strong>the</strong> PWM signal <strong>with</strong> 20% duty cycle<br />

for 10 millisecond to turn on <strong>the</strong> sprinklers in zone two.<br />

6.10. After 15 minutes, your microcontroller must send <strong>the</strong> PWM signal <strong>with</strong> 25% duty cycle<br />

for 10 millisecond to turn off <strong>the</strong> sprinklers in zone two.<br />

6.11. Modify <strong>the</strong> servo motor example to include a potentiometer connected to PORTA[0]. The<br />

servo will deflect 0 degrees for 0 VDC applied to PORTA[0] and 180 degrees for 5 VDC.<br />

6.12. For <strong>the</strong> automated cooling fan example, what would be <strong>the</strong> effect of changing <strong>the</strong> PWM<br />

frequency applied to <strong>the</strong> fan?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!