Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

implementeting PID in mikroC for pic

Status
Not open for further replies.

Vlad.

Full Member level 3
Joined
Jun 4, 2012
Messages
179
Helped
3
Reputation
6
Reaction score
4
Trophy points
1,298
Location
Bucharest/Romania
Activity points
2,568
Hey guys, i try to make a code in mikroC but i can make the PID controoler to work. ok here is the code to genetare pwm and control the duty cycle.
Code: Select all
unsigned short DutyCycle=0;
unsigned int adc_value;


void main() {


PWM1_Init(10000);
PWM1_Start();
PWM1_Set_Duty(DutyCycle);
do {
adc_value = ADC_Read(0);
DutyCycle = adc_value >> 2; // Convert 10-bit ADC value to 8-bit
PWM1_Set_Duty(DutyCycle);
} while(1);
}


I want to read a voltage from a curent sense rezistor series with the source of the mosfet.
Who can help me with a code? Thanks.
 

If you have a very low value resistor in line you can read the voltage across the resistor.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top