Hi, Iam facing problem in MCPWM.
Iam able to generate MCPWM on A0,B0 (P1.19,P1.22) pins. but <deadtime> is not generating in between A0 and B0 . I want to include deadtime I read datasheet everything is correct but it is not generating.
Please check my code and help me.
#include "LPC17xx.h"
int main (void) {
int i=0,j=0; SystemInit(); //Clock and PLL configuration
LPC_SC->PCONP |= (1<<17); /* Power ON Timer0,1 */
LPC_PINCON->PINSEL3 |= (1<<12)|(1<<6); MCPWMA0,B0
LPC_GPIO1->FIODIR |= (1<<19)|(1<<22); //output LPC_MCPWM->MCCCP = (1<<0)|(1<<1)|(1<<2)|(1<<3); LPC_MCPWM->MCCON_SET |=(1<<3)|(1<<31)|(1<<29); MCPWM0 Deadtime enable,DCmode,INVB enable LPC_MCPWM->MCTIM0 = 0; LPC_MCPWM->MCPER0 = 1000; LPC_MCPWM->MCPW0 = 600; LPC_MCPWM->MCDEADTIME = 0x100 ; for(i=0;i<10000;i++) for(j=0;j<1000;j++); LPC_MCPWM->MCCON_SET |= (1<<0); //start MCPWM0 while(1) { LPC_MCPWM->MCPER0 = 500; LPC_MCPWM->MCPW0 = 150;
for(i=0;i<10000;i++) for(j=0;j<1000;j++);
LPC_MCPWM->MCPER0 = 1000; LPC_MCPWM->MCPW0 = 300;
for(i=0;i<10000;i++) for(j=0;j<1000;j++); } }
ThankYou
Iam able to generate MCPWM on A0,B0 (P1.19,P1.22) pins. but </deadtime> is not generating in between A0 and B0 . I want to include deadtime I read datasheet everything is correct but it is not generating.
int i=0,j=0; SystemInit();
LPC_SC->PCONP |= (1<<17); LPC_PINCON->PINSEL3 |= (1<<12)|(1<<6); LPC_GPIO1->FIODIR |= (1<<19)|(1<<22); LPC_MCPWM->MCCCP = (1<<0)|(1<<1)|(1<<2)|(1<<3); LPC_MCPWM->MCCON_SET |=(1<<3)|(1<<31)|(1<<29); LPC_MCPWM->MCTIM0 = 0; LPC_MCPWM->MCPER0 = 1000; LPC_MCPWM->MCPW0 = 600; LPC_MCPWM->MCDEADTIME = 0x100 ; for(i=0;i<10000;i++) for(j=0;j<1000;j++); LPC_MCPWM->MCCON_SET |= (1<<0); while(1) { LPC_MCPWM->MCPER0 = 500; LPC_MCPWM->MCPW0 = 150; for(i=0;i<10000;i++) for(j=0;j<1000;j++); LPC_MCPWM->MCPER0 = 1000; LPC_MCPWM->MCPW0 = 300;
You seem to face some issues reading the instructions how to post source code.
For some reason you put all your focus on writing "</deadtime>" instead of usig the pre tags for the actual code. And in the second attempt you dropped the comments in the code.