Eshnur
Newbie level 3
Hi. How can i add PI Controller on this circuit? btw this circuit works on ISIS but its doesn't work in real life could you help me?
https://imgur.com/n1MAmAf this is circuit
and codes
https://imgur.com/n1MAmAf this is circuit
and codes
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 48 49 50 51 52 53 54 55 56 57 58 59 void main() { set_tris_a(0xFF); set_tris_c(0x01); setup_timer_2(T2_DIV_BY_1,255,1); setup_CCP1(CCP_PWM); int buton_1,buton_2,buton_3,buton_4; int16 Duty=0; float YuzdeDuty; set_pwm1_duty(Duty); while(TRUE) { buton_1=input(pin_A0); buton_2=input(pin_A1); buton_3=input(pin_A2); buton_4=input(pin_A3); if(buton_1 == 1 && buton_2 == 0 && buton_3 == 0 && buton_4 == 0) { delay_ms(20); Duty=250; // YuzdeDuty=25; set_pwm1_duty(Duty); // output_d(YuzdeDuty); } else if(buton_2 == 1 && buton_1 == 0 && buton_3 == 0 && buton_4 == 0) { delay_ms(20); Duty=400; // YuzdeDuty=50; set_pwm1_duty(Duty); //output_d(YuzdeDuty); } else if(buton_3 == 1 && buton_1 == 0 && buton_2 == 0 && buton_4 == 0) { delay_ms(20); Duty=600; //YuzdeDuty=75; set_pwm1_duty(Duty); //output_d(YuzdeDuty); } else if(buton_4 == 1 && buton_1 == 0 && buton_2 == 0 && buton_3 == 0) { delay_ms(20); Duty=850; //YuzdeDuty=100; set_pwm1_duty(Duty); //output_d(YuzdeDuty); } } }
Attachments
Last edited by a moderator: