Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 PWM1_Init(12821); PWM1_Set_Duty(0); CCP1CON.CCP1M3 = 1; CCP1CON.CCP1M2 = 1; CCP1CON.CCP1M1 = 1; CCP1CON.CCP1M0 = 0; CCP1CON.P1M0 = 0; CCP1CON.P1M1 = 1; PWM2_Init(12821); PWM2_Set_Duty(0); CCP2CON.CCP2M3 = 1; CCP2CON.CCP2M2 = 1; CCP2CON.CCP2M1 = 1; CCP2CON.CCP2M0 = 0; CCP2CON.P2M0 = 0; CCP2CON.P2M1 = 1; PWM3_Init(12821); PWM3_Set_Duty(0); CCP3CON.CCP3M3 = 1; CCP3CON.CCP3M2 = 1; CCP3CON.CCP3M1 = 1; CCP3CON.CCP3M0 = 0; CCP3CON.P3M0 = 0; CCP3CON.P3M1 = 1; Delay_ms(200); InitTimer2(); TRISC = 0x00; TRISE = 0x00; TRISG = 0x00; PWM1_Start(); PWM2_Start(); PWM3_Start();
Code C - [expand] 1 2 3 4 5 6 7 CCPxCON.CCPxM3 = 1; CCPxCON.CCPxM2 = 1; CCPxCON.CCPxM1 = 0; CCPxCON.CCPxM0 = 0; CCPxCON.PxM0 = 0; CCPxCON.PxM1 = 1;
Well, the question asks for a decision between two alternatives, but the first is wrong and the second technically impossible.I still have not received any answer for the question I asked in post #1
--> max value of 9bit is 511.Max 9-bit value is 512
I assume its caused by your code.the 3rd phase voltage (pink signal) is distorted
I assume its caused by your code.
;-)I will post code if anybody need to see.
The invention of the time warp...ISR is called once every 78 us (78.1 KHz PWM) and ISR code takes 90 us to execute
Code C - [expand] 1 2 if((DUTY_CYCLE[2] + 20) < 64)DUTY_CYCLE[2] += 20; else DUTY_CYCLE[2] -= 42;
Code C - [expand] 1 2 if((DUTY_CYCLE[2] + 21) < 64)DUTY_CYCLE[2] += 21; else DUTY_CYCLE[2] -= 43;
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 void interrupt() { if((TMR2IE_bit) && (TMR2IF_bit)) { //Enter your code here //SET_FREQ = 65536 / (64 * 2) = 256 //Required AC Frequency = 50 Hz //PWM Freq = 10 KHz //Tpwm = 1/10 KHz = 100 us (Timer2 Interrupt Period) //100 us * 64 * 2 = 12.8 ms (for 180 degrees) //12.8 * 2 = 25.6 ms //AC freq = 1/25.6 ms = 39 Hz TBL_POINTER_NEW[0] = TBL_POINTER_OLD[0] + SET_FREQ; TBL_POINTER_SHIFT[0] = TBL_POINTER_NEW[0] >> 10; DUTY_CYCLE[0] = TBL_POINTER_SHIFT[0]; //Assign PWM duty 10 bit CCPR3L = (sine_table[DUTY_CYCLE[0]] & 0x3FC) >> 2; CCP3CON.DC3B1 = (sine_table[DUTY_CYCLE[0]] & 0x02) >> 1; CCP3CON.DC3B0 = (sine_table[DUTY_CYCLE[0]] & 0x01); TBL_POINTER_OLD[0] = TBL_POINTER_NEW[0]; TBL_POINTER_NEW[1] = TBL_POINTER_OLD[1] + SET_FREQ; TBL_POINTER_SHIFT[1] = TBL_POINTER_NEW[1] >> 10; DUTY_CYCLE[1] = TBL_POINTER_SHIFT[1]; if((DUTY_CYCLE[1] + 42) < 64)DUTY_CYCLE[1] += 42; else DUTY_CYCLE[1] -= 22; CCPR4L = (sine_table[DUTY_CYCLE[1]] & 0x3FC) >> 2; CCP4CON.DC4B1 = (sine_table[DUTY_CYCLE[1]] & 0x02) >> 1; CCP4CON.DC4B0 = (sine_table[DUTY_CYCLE[1]] & 0x01); TBL_POINTER_OLD[1] = TBL_POINTER_NEW[1]; TBL_POINTER_NEW[2] = TBL_POINTER_OLD[2] + SET_FREQ; TBL_POINTER_SHIFT[2] = TBL_POINTER_NEW[2] >> 10; DUTY_CYCLE[2] = TBL_POINTER_SHIFT[2]; if((DUTY_CYCLE[2] + 21) < 64)DUTY_CYCLE[2] += 21; else DUTY_CYCLE[2] -= 43; //Assign PWM duty 10 bit CCPR5L = (sine_table[DUTY_CYCLE[2]] & 0x3FC) >> 2; CCP5CON.DC5B1 = (sine_table[DUTY_CYCLE[2]] & 0x02) >> 1; CCP5CON.DC5B0 = (sine_table[DUTY_CYCLE[2]] & 0x01); TBL_POINTER_OLD[2] = TBL_POINTER_NEW[2]; TMR2IF_bit = 0; } }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 const code unsigned int sine_table[64] = { 0,2,7,16,29,45,64,86, 111,139,169,201,235,270,306,343, 381,418,455,491,526,560,592,622, 650,675,697,716,732,745,754,759, 761,759,754,745,732,716,697,675, 650,622,592,560,526,491,455,418, 381,343,306,270,235,201,169,139, 111,86,64,45,29,16,7,2 };
In Three Phase AC Induction Motor if load varies then V varies.
I got it. I have to read the motor speed (frequency) using tachometer and then adjust the voltage to maintain constant V/F ratio. Right ?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?