renga92
Member level 5
- Joined
- Jun 21, 2012
- Messages
- 85
- Helped
- 2
- Reputation
- 4
- Reaction score
- 2
- Trophy points
- 1,288
- Location
- india
- Activity points
- 2,084
I am working on PIC16F1783 to drive full bridge configuration. I am using PSMC module in this Microcontroller and till now was not successful in getting it to work. I used GUI provided by the Microchip and even the configuration of those registers didn't work out.
I have included the configuration of the registers which I am using currently :
PSMC1CON = 0x00;
PSMC1MDL = 0x80;
PSMC1SYNC = 0x00; // It is synchronised with the period event
PSMC1CLK = 0x01; // Clock source : 64 Mhz from PLL and divide by 1 setting
PSMC1POL = 0x00; // PSMC In and Out are having active high polarity
PSMC1BLNK = 0x00; // No blanking control implmented for both Rising edge and Falling edge
PSMC1REBS = 0x00; // Risinig edge Blanking control input pin selection : No input is selected as the blanking function is not used
PSMC1FEBS = 0x00; // Falling edge Blanking control input pin selection : No input is selected as the blanking function is not used
PSMC1ASDC = 0x00; // PSMC Auto shutdown control register : Autoshutdown function is disabled.
PSMC1ASDL = 0x00; // PSMC Auto shutdown output level register : Autoshutdown will be enabled on which logic value 1 or 0 of the corresponding PWM output
PSMC1ASDS = 0x00; // PSMC Auto shutdown source register : No pin is selected as the input tirgger for the auto shutdown
/* Loading the phase diff, duty cycle and period registers*/
PSMC1DCH = 0x00; // PSMC Duty cycle high byte register value
PSMC1DCL = 0x03; // PSMC Duty cycle low byte register value
PSMC1PRH = 0x00; // PSMC Period count high byte register value
PSMC1PRL = 0x05; // PSMC Period count low byte register value
PSMC1PHH = 0x00; // PSMC Phase count high byte register value
PSMC1PHL = 0x00; // PSMC Phase count low byte register value
/* End of loading the phase diff, duty cycle and period registers*/
PSMC1DBR = 0x00; // PSMC Rising edge dead band time register count
PSMC1DBF = 0x00; // PSMC Falling edge dead band time register count
PSMC1FFA = 0x00; // PSMC Fractional Frequency Adjust register
PSMC1BLKR = 0x00; // PSMC rising edge Blanking time register
PSMC1BLKF = 0x00; // PSMC Falling edge Blanking time register
PSMC1STR0 = 0x00; // (Changed value from 0x0F to 0x00)PSMC PWM steering control register 0 : It is used to choose when the single PWM or 3 phase PWM mode is used ; It can select individual pins for PWM drive ; in complementary or no complemenatary output
PSMC1STR1 = 0x00; // PSMC steering control register 1 :
PSMC1INT = 0x00; // PSMC Time base interrupt control Register
/* Source selection for tiggering the Rising, Falling and period event*/
PSMC1PHS = 0x01; // PSMC phase source(Rising Edge triggering event) : No pin is selected for phase source triggering as it is triggered by the internal timer
PSMC1DCS = 0x01; // PSMC Duty Cycle(Falling Edge triggering event) : No pin is selected for Duty cycle(Falling edge) triggering as it is triggered by the internal timer
PSMC1PRS = 0x01; // PSMC Period source selection register : Internal Timer is selected as the source and it will get reset when the timer count is equal to the PR register count
/* End of source sel*/
PSMC1OEN = 0x0F; // PSMC Output pin enable for PWM drive register(A,B,C,D Output PWM drive)
PSMC1CON = 0b11000100;
PIE4 &= 0xEE;
PIE4 |= 0x01;
I have included the configuration of the registers which I am using currently :
PSMC1CON = 0x00;
PSMC1MDL = 0x80;
PSMC1SYNC = 0x00; // It is synchronised with the period event
PSMC1CLK = 0x01; // Clock source : 64 Mhz from PLL and divide by 1 setting
PSMC1POL = 0x00; // PSMC In and Out are having active high polarity
PSMC1BLNK = 0x00; // No blanking control implmented for both Rising edge and Falling edge
PSMC1REBS = 0x00; // Risinig edge Blanking control input pin selection : No input is selected as the blanking function is not used
PSMC1FEBS = 0x00; // Falling edge Blanking control input pin selection : No input is selected as the blanking function is not used
PSMC1ASDC = 0x00; // PSMC Auto shutdown control register : Autoshutdown function is disabled.
PSMC1ASDL = 0x00; // PSMC Auto shutdown output level register : Autoshutdown will be enabled on which logic value 1 or 0 of the corresponding PWM output
PSMC1ASDS = 0x00; // PSMC Auto shutdown source register : No pin is selected as the input tirgger for the auto shutdown
/* Loading the phase diff, duty cycle and period registers*/
PSMC1DCH = 0x00; // PSMC Duty cycle high byte register value
PSMC1DCL = 0x03; // PSMC Duty cycle low byte register value
PSMC1PRH = 0x00; // PSMC Period count high byte register value
PSMC1PRL = 0x05; // PSMC Period count low byte register value
PSMC1PHH = 0x00; // PSMC Phase count high byte register value
PSMC1PHL = 0x00; // PSMC Phase count low byte register value
/* End of loading the phase diff, duty cycle and period registers*/
PSMC1DBR = 0x00; // PSMC Rising edge dead band time register count
PSMC1DBF = 0x00; // PSMC Falling edge dead band time register count
PSMC1FFA = 0x00; // PSMC Fractional Frequency Adjust register
PSMC1BLKR = 0x00; // PSMC rising edge Blanking time register
PSMC1BLKF = 0x00; // PSMC Falling edge Blanking time register
PSMC1STR0 = 0x00; // (Changed value from 0x0F to 0x00)PSMC PWM steering control register 0 : It is used to choose when the single PWM or 3 phase PWM mode is used ; It can select individual pins for PWM drive ; in complementary or no complemenatary output
PSMC1STR1 = 0x00; // PSMC steering control register 1 :
PSMC1INT = 0x00; // PSMC Time base interrupt control Register
/* Source selection for tiggering the Rising, Falling and period event*/
PSMC1PHS = 0x01; // PSMC phase source(Rising Edge triggering event) : No pin is selected for phase source triggering as it is triggered by the internal timer
PSMC1DCS = 0x01; // PSMC Duty Cycle(Falling Edge triggering event) : No pin is selected for Duty cycle(Falling edge) triggering as it is triggered by the internal timer
PSMC1PRS = 0x01; // PSMC Period source selection register : Internal Timer is selected as the source and it will get reset when the timer count is equal to the PR register count
/* End of source sel*/
PSMC1OEN = 0x0F; // PSMC Output pin enable for PWM drive register(A,B,C,D Output PWM drive)
PSMC1CON = 0b11000100;
PIE4 &= 0xEE;
PIE4 |= 0x01;