Question: Zoom in to see question clearly. Need Help. Given the code excerpt below: #include #include int main() { DDRD = OxFF: PORTD=0x00; // setup PWM

Zoom in to see question clearly.

Need Help.

Zoom in to see question clearly. Need Help. Given the code excerpt

Given the code excerpt below: #include #include int main() { DDRD = OxFF: PORTD=0x00; // setup PWM output using fast PWM non-inverting mode TCCROA = 0x03; TCCROB = 0x04; TCNTO = 250; // setup timer count to overflow for PWM at 1kHz (1ms) while(1) { if( TIFRO & 0x01) { // polls for timer overflow TCNT1 = 250: } } You expect a single PWM output and you connect PIN5 to a digital logic analyser. Will your code run as expected? Why (or why not)? (Note: there may be more than one answer. Treat each answer individually) Yes, the code will work and the PWM signal frequency read from the analyser will be slightly lower than 1kHz. Even if the PWM output works, the frequency would not be 1kHz due to pre-scaler of timer. No, your analyser will read no signals because your duty cycle hasn't been set. No, your analyser will read no signal since it is connected to the wrong pin No, your analyser will read no signals because the output pin has been not setup properly. Even if the PWM output works, the frequency would be much quicker than you expect. No, the wrong port and pin has been used. It should be PORTB rather than PORTD. No, your analyser will read no signals because your overflow flag is always high. Given the code excerpt below: #include #include int main() { DDRD = OxFF: PORTD=0x00; // setup PWM output using fast PWM non-inverting mode TCCROA = 0x03; TCCROB = 0x04; TCNTO = 250; // setup timer count to overflow for PWM at 1kHz (1ms) while(1) { if( TIFRO & 0x01) { // polls for timer overflow TCNT1 = 250: } } You expect a single PWM output and you connect PIN5 to a digital logic analyser. Will your code run as expected? Why (or why not)? (Note: there may be more than one answer. Treat each answer individually) Yes, the code will work and the PWM signal frequency read from the analyser will be slightly lower than 1kHz. Even if the PWM output works, the frequency would not be 1kHz due to pre-scaler of timer. No, your analyser will read no signals because your duty cycle hasn't been set. No, your analyser will read no signal since it is connected to the wrong pin No, your analyser will read no signals because the output pin has been not setup properly. Even if the PWM output works, the frequency would be much quicker than you expect. No, the wrong port and pin has been used. It should be PORTB rather than PORTD. No, your analyser will read no signals because your overflow flag is always high

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!