In this lab, you will develop a DC power supply whose voltage is regulated via the Timer/Counter subsystem of the ATmega32 microcontroller. The application will operate by supplying a specific charge at precise intervals to a capacitor in an RC circuit. By adjusting the charge, you can regulate the RC circuit to mainain a “constant” DC value in the range from about 0-5 VDC. Keep in mind that this is not the best way to implement a variable DC power supply, but it will allow us to make use of the ADC and Timer/Counter subsystems.
You will need to wire the circuit shown below on your breadboard. You can obtain the parts from Technical Support.
The following hardware must be connected:
Write a assembly program that implements the following requirements:
Your program should be placed in lab8.asm and must:
You are required to demonstrate your program to your instructor in phases. Start by connecting the LED display to PORTB. This will provide you with a visual indication (via PB0, PB1, PB2, and PB3) that your program is somewhat functional. As you use the keypad to vary the duty cycle of OC0, you should observe a correspondingly varying degree of brightness on the LED connected to PB3 as it gets rapidly switched on and off. If this LED is completely off, it should correspond to a OCR0 value of 255; completely on corresponds to an OCR0 value of 0. Neither the automatic activation of the ADC by the T/C1 interrupt, nor the LCD display are required to be finished in this phase.
Complete this phase by the end of the first lab. This will count towards 20% of your overall grade for this lab.
For the second phase, which must be demonstrated by the end of the second lab, replace the LED board with the breadboard containing the RC circuitry. Connect the ADC input pin to the capacitor lead. Simultaneously connect the capacitor to the oscilloscope and display the voltage signal there. Complete the implementation of both the automatic initiation of the AD conversion as well as the LCD display logic, so that the LCD displays both the value contained within the OCR0 register as well as the voltage measured by the AD converter.
You should indicate how much time (in minutes) you spend on this assignment in the FAST database. You are encouraged to log your activity as you work on the project. At a minimum, you should log all of the time spent on this assignment before the due date given above. All time spent on this assignment should be entered into the week 9 and week 10 columns (even if you worked on it in week 8).