Knowee
Questions
Features
Study Tools

You have configured the PIC as follows:RC2 is configured as an outputTMR1 to run with a 1:1 prescaler and calls myTMR1ISR whenever TMR1 rolls over.What is the frequency and duty cycle of the waveform formed on RC2?void myTMR1ISR(void) { if (PORTCbits.RC2 == 1) { LATCbits.LATC2 = 0; TMR1_WriteTimer(0x10000 - 8000); } else { LATCbits.LATC2 = 1; TMR1_WriteTimer(0x10000 - 24000); } PIR1bits.TMR1IF = 0;}Group of answer choicesNone of the above500 Hz at 25% duty cycle2000 Hz at 66% duty cycle2000 Hz at 33% duty cycle500 Hz at 75% duty cycle

Question

You have configured the PIC as follows:RC2 is configured as an outputTMR1 to run with a 1:1 prescaler and calls myTMR1ISR whenever TMR1 rolls over.What is the frequency and duty cycle of the waveform formed on RC2?void myTMR1ISR(void) { if (PORTCbits.RC2 == 1) { LATCbits.LATC2 = 0; TMR1_WriteTimer(0x10000 - 8000); } else { LATCbits.LATC2 = 1; TMR1_WriteTimer(0x10000 - 24000); } PIR1bits.TMR1IF = 0;}Group of answer choicesNone of the above500 Hz at 25% duty cycle2000 Hz at 66% duty cycle2000 Hz at 33% duty cycle500 Hz at 75% duty cycle

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The frequency and duty cycle of the waveform formed on RC2 can be calculated as follows:

First, we need to calculate the total period of the waveform. The total period is the sum of the time when the output is high and the time when the output is low.

The time when the output is high is given by the timer value when RC2 is 0, which is 0x10000 - 8000 = 0x8000. Since the timer is 16-bit, the time is 0x8000 / 0x10000 = 0.5 seconds.

The time when the output is low is given by the timer value when RC2 is 1, which is 0x10000 - 24000 = 0xE000. The time is 0xE000 / 0x10000 = 0.875 seconds.

So, the total period of the waveform is 0.5 + 0.875 = 1.375 seconds. Therefore, the frequency is 1 / 1.375 = 0.727 Hz.

The duty cycle is the percentage of the total period when the output is high. So, the duty cycle is 0.5 / 1.375 = 0.36 or 36%.

Therefore, none of the given options is correct. The correct answer is 0.727 Hz at 36% duty cycle.

This problem has been solved

Similar Questions

You need to generate a 3906.25 Hz PWM waveform on RC2 using a 1:1 prescaled TMR1 ISR shown below. The duty cycle is set using a global uint8_t variable called dutyCycle.What is the value of scale?void myTMR1ISR(void) { if (PORTCbits.RC2 == 1) { LATCbits.LATC2 = 0; TMR1_WriteTimer(0x10000 - (MAX - scale*dutyCycle)); } else { LATCbits.LATC2 = 1; TMR1_WriteTimer(0x10000 - scale*dutyCycle); } PIR1bits.TMR1IF = 0;}  Answer not given   4 Correct!  16   64   100

You have configured the PIC as follows:EUSART to run at 9600 BaudTMR to run with a 1:1 prescaler and call myTMR1ISR whenever TMR1 rolls over.The constant ONE_MILLISECOND is the number of 1:1 prescaled TMR1 counts that occur in 1 millisecond. Which of the following best describes the behavior observed on the terminal when the PIC is executing the following ISR?void myTMR1ISR(void) { printf("One Long String\r\n"); PIR1bits.TMR1IF = 0; TMR1_SetTimer(0x10000 - ONE_MILLISECOND);}Group of answer choicesAn unknown, but consistent delay between print messages, main responsiveNo delay between messages being printed, main unresponsive1ms delay between print messages, main responsive

The following function is related to PWM mode for PIC:Select one:a. Variations in the status of an output pinb. Detection of an exact point at which the change occurs in an input edgec. To generate rectangular waveform with programmable duty cycle with an user assigned frequencyd. Generation of an interrupt

The following function is related to PWM mode for PIC:Select one:a. Detection of an exact point at which the change occurs in an input edgeb. Variations in the status of an output pinc. To generate rectangular waveform with programmable duty cycle with an user assigned frequencyd. Generation of an interrupt

An embedded C program is used to generate the square waveform using timer 0 in mode 2. The TH0 is loaded with 48h. What is the frequency of the square waveform.

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.