Logo Passei Direto
Buscar

qual das alternativas?

Considerando o PIC16F877A, que utiliza temporizador Timer 2 de 8 bits e módulo CCP com PWM de 10 bits, operando com clock de 4 MHz, determine qual dos algoritmos a seguir produzirá um PWM com ciclo de trabalho de 30% e frequência de 2kHz?

A. 

TRISC2 = 0;

PR2 = 124;

CCPR1L = 37;

CCP1CONbits.CCP1X = 1;

CCP1CONbits.CCP1Y = 0;

T2CONbits.T2CKPS = 0b01;

T2CONbits.TMR2ON = 1;

CCP1CONbits.CCP1M = 0b1111;

B. 

TRISC2 = 0;

​​​​​​​PR2 = 31;

CCPR1L = 37;

CCP1CONbits.CCP1X = 0;

CCP1CONbits.CCP1Y = 1;

T2CONbits.T2CKPS = 0b01;

T2CONbits.TMR2ON = 1;

CCP1CONbits.CCP1M = 0b0011;

C. 

TRISC2 = 0;

​​​​​​​PR2 = 124;

CCPR1L = 150;

CCP1CONbits.CCP1X = 1;

CCP1CONbits.CCP1Y = 0;

T2CONbits.T2CKPS = 0b01;

T2CONbits.TMR2ON = 1;

CCP1CONbits.CCP1M = 0b1100;

D. 

TRISC2 = 0;

​​​​​​​PR2 = 37;

CCPR1L = 150;

CCP1CONbits.CCP1X = 0;

CCP1CONbits.CCP1Y = 1;

T2CONbits.T2CKPS = 0b10;

T2CONbits.TMR2ON = 1;

CCP1CONbits.CCP1M = 0b0011;

E. 

TRISC2 = 0;

​​​​​​​PR2 = 31;

CCPR1L = 37;

CCP1CONbits.CCP1X = 0;

CCP1CONbits.CCP1Y = 1;

T2CONbits.T2CKPS = 0b00;

T2CONbits.TMR2ON = 0;

CCP1CONbits.CCP1M = 0b1111;


User badge image
Emerson Florencio Camargo

há 3 anos

Respostas

User badge image

Ed Verified user icon

há 2 anos

A alternativa correta para produzir um PWM com ciclo de trabalho de 30% e frequência de 2kHz, considerando o PIC16F877A, é a alternativa B. Explicação: - TRISC2 = 0: Configura o pino RC2 como saída. - PR2 = 31: Define o valor do registrador PR2 como 31. - CCPR1L = 37: Define o valor do registrador CCPR1L como 37. - CCP1CONbits.CCP1X = 0: Configura o bit CCP1X como 0. - CCP1CONbits.CCP1Y = 1: Configura o bit CCP1Y como 1. - T2CONbits.T2CKPS = 0b01: Configura o prescaler do Timer 2 como 1:4. - T2CONbits.TMR2ON = 1: Liga o Timer 2. - CCP1CONbits.CCP1M = 0b0011: Configura o módulo CCP1 como PWM, modo P1A/P1C ativo-alto, P1B/P1D ativo-baixo. Essa configuração irá gerar um sinal PWM com ciclo de trabalho de 30% e frequência de 2kHz.

Essa resposta te ajudou?

0
Dislike0

Ainda com dúvidas?

Envie uma pergunta e tenha sua dúvida de estudo respondida!

Mais conteúdos dessa disciplina