Homework 6 Solution

Previously the program used interrupts to update the

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: r the ADC conversion result to be ready. Write 1 to ADCS will start the ADC conversion. When it is done, the ADCS bit will return to 0. The program then may read the ADCW value. Question 6: ATmega128 ADC Programming (10 pts) Assume ATmega128 platform with the system clock configured to 4MHz (for improved power efficiency). Write two C statements to configure the ADC as follows: • Interrupt enabled • One- shot mode • ADC clock rate in the range of 50K- 200K Hz • Reference voltage is Vcc • No differential input Name: Lab Section: • • ADCW right adjusted The initial input channel is 7 Interrupt enabled ADIE = 1 One- shot mode ADFR = 0 ADC clock rate in the range of 50K- 200K Hz Make a table. The only good frequency is 125 KHz or 62.5KHz, for ADPS = 101 or 110 System clock rate is 4MHz ADPS 000 001 010 011 100 101 110 111 Div. Fac. 2 2 4 8 16 32 64 128 Freq. 2 MHz 2 MHz 1 MHz 500 KHz 250 Khz 125 KHz 62.5KHz 31.25KHz Reference voltage is Vcc REFS = 01 No differential input MUX4 and MUX3 are 0s ADCW right adjusted ADLAR = 0 The initial input channel is 7 MUX2, MUX1, MUX0 = 1,...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern