This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430G2553: PWM MSP430G2553

Part Number: MSP430G2553
Other Parts Discussed in Thread: MSP430F2132

Hello!
I have this firmware simulating in the Proteus 8.6 software with the MSP430F2132 card, it is working perfectly the PWM and ADC, however I need to use the MSP430G2553 card and I am not getting pwm signal output results. Could someone guide me on what to do to get the same firmware for the MSP430G2553?

Thank you!

/*******************************************************************************
*                                 FACIT                                        *
*                          Sistemas Embarcados                                 *
********************************************************************************
* VERSÃO:1.0                                                                   *
* DATA:06/06/2018                                                              *
*******************************************************************************/

/*******************************************************************************
*                       DESCRIÇÃO GERAL DO FIRMWARE                            *
*******************************************************************************/
/*


*/

/*==============================================================================
1. ARQUIVOS DE DEFINIÇÕES (INCLUDES)
==============================================================================*/
//#include "msp430F2132.h" // Biblicota domicrocontrolador MSP430F2132
#include "msp430g2553.h" 
#include <intrinsics.h>
int valor=80;

/*==============================================================================
2. DECLARAÇÕES
==============================================================================*/
void configura_pwm(void);

void configura_DCO(void);


/*==============================================================================
3. PROTOTIPAGEM DE FUNÇÕES
==============================================================================*/

void configura_adc(void);

void configura_DCO(void);


/*==============================================================================
5. FUNÇÃO PRINCIPAL
==============================================================================*/

int main( void )
{
    WDTCTL = WDTPW + WDTHOLD; // Desativa o watchdog timer 
  P1DIR |= 0xFF;            // Configura P1 como Saída 
  P1SEL |= BIT3;	           // Função alternativa para P1.2(TA1) e P1.3(TA2)
  
  configura_pwm();
  // Configurações
  WDTCTL = WDTPW + WDTHOLD;     // Desativa o watchdog timer
  
  configura_DCO();

  // Configuração das portas
  P1DIR = 0xFF;                     // Configura todos os bits como saída 
  P1OUT = 0x00;                     // Limpa a saída
  valor=ADC10MEM;
  configura_adc();
  valor=ADC10MEM;
  for (;;)
  {
   valor=ADC10MEM;
   ADC10CTL0 |= ENC + ADC10SC;        // Inicia amostragem e conversão
 
    __bis_SR_register(CPUOFF + GIE);   // Coloca no modo LPM0 e habilita
                                    // interrupção geral
    CCR1 = (512-valor);
    }}
    
   /*==============================================================================
6. FUNÇÃO DO USUÁRIO
==============================================================================*/

void configura_adc()
{
      ADC10CTL1 = INCH_1 + ADC10DIV_3 ;         // Channel 3, ADC10CLK/3
      ADC10CTL0 = SREF_0 + ADC10SHT_3 + ADC10ON + ADC10IE;  // Vcc & Vss as reference, Sample and hold for 64 Clock cycles, ADC on, ADC interrupt enable
      ADC10AE0 |= BIT3;  
}

void configura_pwm()
{
    CCR0 = 512;               // Período do PWM (contagem do TAR)512
    CCTL1 = OUTMOD_7;         // Modo de operação 7 Reset/set
    CCR1 = valor;               // Duty cycle (ciclo ativo = 75%)384
    CCTL2 = OUTMOD_7;         // Modo de operação 7 Reset/set
    CCR2 = 50;               // Duty cycle (ciclo ativo = 25%)128
    TACTL = TASSEL_2 + MC_1 + ID_2 ;  // Fonte de clock SMCLK, Modo de contagem crescente 
}

// Rotina de Tratamento de interrupção ISR do ADC10
#pragma vector=ADC10_VECTOR
__interrupt void ADC10_ISR(void)
{
  __bic_SR_register_on_exit(CPUOFF);        // Retira a CPU do modo LPM0
}

// Calibrando a frequência do DCO
void configura_DCO(void)
{
  if (CALBC1_1MHZ ==0xFF || CALDCO_1MHZ == 0xFF)                                     
  {  
    while(1);                        // Se constantes de calibração apagadas
                                     // aguardar CPU!!
  } 
  // 1Mhz
  BCSCTL1 = CALBC1_1MHZ;             // Configura intervalo
  DCOCTL = CALDCO_1MHZ;              // Configura DCO + modulação  */

}


/*==============================================================================
                               FIM DO ARQUIVO
==============================================================================*/

Result with MSP430F2132

Result with MSP430g2553

**Attention** This is a public forum