Autor Tema: Generar PWM modo push-pull con dspic30 modulo control PWM motor  (Leído 3244 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado pic32

  • PIC12
  • **
  • Mensajes: 57
Generar PWM modo push-pull con dspic30 modulo control PWM motor
« en: 06 de Junio de 2013, 06:52:36 »
//Generar PWM modo push-pull con el modulo PWM de motores

Hola, Alguno sabe como generar PWM en modo Push-pull con el control de motores PWM?? Estoy usando un DSPIC30f6015 y a la hora de programarlo he visto que tiene el modo complementario e independiente, pero no veo como hacer el desfase de una señal respecto a la otra y añadir los dead time.



En este ejemplo esta facil porque este micro tiene un registro de fase que lo hace simplemente pero con mi micro no dispongo de ese registro.


#include "p30f2020.h"

/* Configuration Bit Settings */
_FOSCSEL(FRC_PLL)
_FOSC(CSW_FSCM_OFF & FRC_HI_RANGE & OSC2_CLKO)
_FPOR(PWRT_128)
_FGS(CODE_PROT_OFF)
_FBS(BSS_NO_FLASH)

/*****************************************************************************/
/*                      STANDARD PWM INITIALIZATION CODE                     */
/*****************************************************************************/
void init_PWM()
{
    /*~~~~~~~~~~~~~~~~~~~~~~~ PWM1 Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/   
    /* PWM1 I/O Control Register register */
    IOCON1bits.PENH      = 0;      /* PWM1H is controlled by GPIO module */
    IOCON1bits.PENL      = 1;      /* PWM1L is controlled by PWM module */
    IOCON1bits.PMOD      = 1;      /* Select Independent Output PWM mode */

    /* Load PDC1 register with initial Duty Cycle value */
    PDC1 = 640;

    /* Load PDTR1 and ALTDTR2 register with preset dead time value */
    DTR1    = 64;                  /* Deadtime setting */
    ALTDTR1 = 64;                  /* Deadtime setting */

    /* PHASE1 register */
    PHASE1 = 0;                    /* No phase shift */

 
    /*~~~~~~~~~~~~~~~~~~~~~~~ PWM2 Configuration ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
    /* PWM2 I/O Control Register register */
    IOCON2bits.PENH      = 0;      /* PWM2H is controlled by GPIO module */
    IOCON2bits.PENL      = 1;      /* PWM2L is controlled by PWM module */
    IOCON2bits.PMOD      = 1;      /* Select Independent Output PWM mode */

    /* Load PDC2 register with initial Duty Cycle value */
    PDC2 = 640;

   
    /* Load PDTR2 and ALTDTR2 register with preset dead time value */
    DTR2    = 64;                  /* Deadtime setting */
    ALTDTR2 = 64;                  /* Deadtime setting */

    /* PHASE2 register */
    PHASE2 = 240;                  /* approximately 250 nsec phase shift */

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
 
    /* Configure PTPER register to produce 400kHz PWM frequency */
    PTPER = 2380;                 /* PWM Period @30 MIPS, 2.5usec == 400kHz */

    /* PWM Time Base Control Register */
    PTCONbits.PTEN       = 1;     /* Enable the PWM Module */
}

/******************************************************************************/
/*                             MAIN ROUTINE                                   */
/******************************************************************************/
int main()
{
    TRISEbits.TRISE1 = 0;         /* Set RE1 as a digital output */
    TRISEbits.TRISE3 = 0;         /* Set RE3 as a digital output */
   
    LATEbits.LATE1 = 0;
    LATEbits.LATE3 = 0;
   
    init_PWM();
   
    while(1);                     /* Infinite Loop */
}

Desconectado pic32

  • PIC12
  • **
  • Mensajes: 57
Re: Generar PWM modo push-pull con dspic30 modulo control PWM motor
« Respuesta #1 en: 23 de Agosto de 2013, 09:06:42 »
A nadie se le ocurre nada, para generar los pulsos de manera hardware como en la imagen?