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.

Software Hysteresis For A/D

Status
Not open for further replies.

wuchy143

Member
Hello,

I have a PIC12F615 which I'm using it's 10bit A/D to read a POT from 0-5V. I'm then taking that A/D reading dividing it down by 4 so that I can use it to plug into a timer which I'm using for PWM. This gives me 8 bits of resolution for my PWM signal.

Problems: My PWM signals jumps around a lot due to the instability of the A/D reading. At times if you tune the pot correctly I am able to get the PWM to go back and forth between 2 levels.

I understand that I need to implement some software hysteresis to properly address this issue and was wondering if anyone had some good approaches for my current system.

Thanks
 
You can read the ADC in 8 bit mode.
Have you thought of averaging 4 readings? Or averaging and through out any reading very different than the average.
 
Yep averaging a few readings will work well. Add 4 x 10-bit values together and then divide by 16 to give you your 8-bit averaged result.

Also, because a pot is a slow moving analog signal you could put a small value capacitor on the analog input pin.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top