Learning Goal: I’m working on a assembly language question and need an explanati

Learning Goal: I’m working on a assembly language question and need an explanation and answer to help me learn.In this problem, you will design a voltage regulator using the PID control technique. Theregulator is controlled by the Atmega2560. The reference voltage of the ADC module is +5V (seethe AVCC pin of the Atmega2560). For the regulator, the reference voltage is provided by thepotentiometer (max voltage is +5V), and the reference voltage is connected to the ADC0 channel(REF terminal). This reference will be used as the input of the PID (or PI) controller, and thefeedback information is the output voltage of the regulator (FB terminal), which is connected to theADC1. The output of the PID controller is the PWM (the PWM frequency is about 1kHz ) signalgenerated on pin OC0A (output compare pin A of the 8-bit timer0). The output voltage of theregulator is proportional to the duty cycle of the PWM signal. The output of the regulator is filteredby a low-pass filter (RC circuit). You will use the PID controller to adjust the duty cycle of thePWM signal according to the reference voltage. The reference voltage and the actual voltage of theregulator are shown on the 7-segment display, you can select which information (reference oroutput voltage) will be displayed using a switch (SECT terminal, which is connected to the externalinterrupt INT0). The Proteus file will be provided. The program has five parts as following:[1][25pts] 7-Segment Display:Write a program to display the voltage value on the 7-segment display in the float number format(numbers of significant digits is two), for example, when the voltage value is 3.456V, the 7-segmentwill display 03.46. Write a function to display a float number on the 7-segment display.Tips: You can multiply the float number by 100 (for example, 3.45 x 100 = 345). The product of the float number and 100 will be an integer number, it can be displayed easilyon the 7-segment. You will decide which digit decimal point will be turned on, for example, the float numberis 4.57, the 7-segment will display 04.57, so the decimal point of the second digit will beturned on.[2][15pts] ADCWrite a program to initial the ADC module.Tips: Select the reference voltage (AVCC pin). Initial the ADC clock frequency (50kHz to 200kHz). You can write a function for ADC read, from the input voltage (REF or FB), and convertthe digital value to the analog voltage, for example, if the ADC returns a value of 512, sothe analog voltage will be 2.5V, the output of this function is an analog voltage value.[3][10pts] SECT SwitchWrite a program to select which information (REF or FB) will be displayed. This switchconnects to the external interrupt INT0, so you should use the interrupt service routine.Tips: Initial the INT0, select the interrupt sense. In the interrupt service routine, select the data will be displayed on the 7-segment (considerthe logical level on the SECT pin), for example, if SECT is low, REF will be displayed,otherwise, the FB will be displayed.[4][15pts] PWMWrite a program to initial the Timer/Counter0 module to generate the PWM signal on the OC0Apin that will control the voltage regulator. The frequency of the PWM signal is about 1 kHz. Notethat the system clock frequency is 16MHz. For the highest resolution of the PWM, the timer periodshould be set at the MAX value (255).Tips: You can reuse the program in the example program (PWM) provided in the lecture. Based on the timer period (255), calculate the prescaler factor to get PWM frequency closestto 1kHz.[5][35pts] PID ControllerWrite a program for PID controller. The input of the controller is the REF value, and thefeedback is the FB value. The output of the PID controller is the value that you will write to theOutput Compare Register A, and this value is from 0 to 255 for the duty cycle from 0 to 100%,respectively.Tips: You can reuse the PID controller provided in the lecture. Try to tune the ki, kp, and kd terms (for PID controller), or ki and kp (for PI controller) forthe best output (it means there are no overshoot, fast response).
Requirements: 1 page   |   .doc file | C

Leave a Reply

Your email address will not be published. Required fields are marked *