Question: please answer this Write a C program for the ATmega328P to generate a Pulse Width Modulation (PWM) Output using counter/timer. The PWM signal generated cannot

 please answer this Write a C program for the ATmega328P to
generate a Pulse Width Modulation (PWM) Output using counter/timer. The PWM signal
please answer this

Write a C program for the ATmega328P to generate a Pulse Width Modulation (PWM) Output using counter/timer. The PWM signal generated cannot directly drive a motor, i.e., it cannot provide the required current due to current limitations in the MCU I/O pins. The signal has to be connected to a motor driver that is available in the lab. The use of delays to generate PWM are NOT allowed in this lab. You can use delays only to de-bounce a button-press and to wait for long periods of time, if needed. You will observe the control signal through an oscilloscope. Write a function called setPWMtimer1 that accepts two parameters, frequency and duty cycle. Upon receiving the two parameters, the function setPWM sets up timer for its operation as per the parameters. If for some reason, the values are beyond what could be achieved using hardware PWM considering internal clocks only, then the function should return -1; otherwise, to indicate that the PWM was setup successfully, the function should return bits (an unsigned char containing the bits of the course source CS12, CS11, C510). Now, write two more functions called startTimeri and stopTimeri. Function startTimeri, will simply start the timer while stopTimer1 will stop it, without affecting any other configuration. Also note that not all possible values of frequencies and duty cycles are possible. In order to avoid confusing the user of the function, kindly write what values will work as comment. Write a C program for the ATmega328P to generate a Pulse Width Modulation (PWM) output using counter/timer. The PWM signal generated cannot directly drive a motor, i.e., it cannot provide the required current due to current limitations in the MCU I/O pins. The signal has to be connected to a motor driver that is available in the lab. The use of delays to generate PWM are NOT allowed in this lab. You can use delays only to de-bounce a button-press and to wait for long periods of time, if needed. You will observe the control signal through an oscilloscope. Write a function called setPWMtimer1 that accepts two parameters, frequency and duty cycle. Upon receiving the two parameters, the function setPWM sets up timer1 for its operation as per the parameters. If for some reason, the values are beyond what could be achieved using hardware PWM considering internal clocks only, then the function should return -1; otherwise, to indicate that the PWM was setup successfully, the function should return bits (an unsigned char containing the bits of the course source CS12, cs11, cs10). Now, write two more functions called startTimer1 and stop Timer1. Function startTimer1, will simply start the timer while stopTimer1 will stop it, without affecting any other configuration. Also note that not all possible values of frequencies and duty cycles are possible. In order to avoid confusing the user of the function, kindly write what values will work as comment Write a C program for the ATmega328P to generate a Pulse Width Modulation (PWM) Output using counter/timer. The PWM signal generated cannot directly drive a motor, i.e., it cannot provide the required current due to current limitations in the MCU I/O pins. The signal has to be connected to a motor driver that is available in the lab. The use of delays to generate PWM are NOT allowed in this lab. You can use delays only to de-bounce a button-press and to wait for long periods of time, if needed. You will observe the control signal through an oscilloscope. Write a function called setPWMtimer1 that accepts two parameters, frequency and duty cycle. Upon receiving the two parameters, the function setPWM sets up timer for its operation as per the parameters. If for some reason, the values are beyond what could be achieved using hardware PWM considering internal clocks only, then the function should return -1; otherwise, to indicate that the PWM was setup successfully, the function should return bits (an unsigned char containing the bits of the course source CS12, CS11, C510). Now, write two more functions called startTimeri and stopTimeri. Function startTimeri, will simply start the timer while stopTimer1 will stop it, without affecting any other configuration. Also note that not all possible values of frequencies and duty cycles are possible. In order to avoid confusing the user of the function, kindly write what values will work as comment. Write a C program for the ATmega328P to generate a Pulse Width Modulation (PWM) output using counter/timer. The PWM signal generated cannot directly drive a motor, i.e., it cannot provide the required current due to current limitations in the MCU I/O pins. The signal has to be connected to a motor driver that is available in the lab. The use of delays to generate PWM are NOT allowed in this lab. You can use delays only to de-bounce a button-press and to wait for long periods of time, if needed. You will observe the control signal through an oscilloscope. Write a function called setPWMtimer1 that accepts two parameters, frequency and duty cycle. Upon receiving the two parameters, the function setPWM sets up timer1 for its operation as per the parameters. If for some reason, the values are beyond what could be achieved using hardware PWM considering internal clocks only, then the function should return -1; otherwise, to indicate that the PWM was setup successfully, the function should return bits (an unsigned char containing the bits of the course source CS12, cs11, cs10). Now, write two more functions called startTimer1 and stop Timer1. Function startTimer1, will simply start the timer while stopTimer1 will stop it, without affecting any other configuration. Also note that not all possible values of frequencies and duty cycles are possible. In order to avoid confusing the user of the function, kindly write what values will work as comment

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!