Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

how to compare to analog signal.... pic184f331

Status
Not open for further replies.

chinusneha

New Member
hi friends ,

i want to compare to analog dc signal & want 2 change the duty cycle of PWM according to the error signal... how can i do that??

if someone having C code... plz help me....
 
You setup the A/D, run the conversion, get the numbers out of ADRESH & L, scale them with a multiply instruction, offset them them with an add or subtract, then load them into the PWM registers.

Usually. If a linear relationship won't do it, you may have to write a big lookup table. If the whole thing needs to be a PID loop, that's even more fun. Start with the basic linear function, though.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top