Need help with PIC assembler

Status
Not open for further replies.

msmax

Full Member level 1
Joined
May 6, 2001
Messages
99
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Pays Bas
Activity points
919
I use a 16F628 & ADC0831 to read analogue value and compare with preset levels to switch an output on/off if value exceeds.

Problem is that de output starts pulsing if the analogue value inreases towards the preset level and if the preset level is reached it switches steady on.

What I need is a kind of hysteresis so the output switches only ON or OFF without pulsing.

Are you familiar with this and how do you program this in assembler?
May be an interval between analogue input scans?
 

That is not very complicated, all you have to do is the following:

You must take into account if the output is on or off before doing your comparison which switches the output on or off.

Here are the two examples for switching on or off:

If your output is currently off, compare your analog value with a reference value slightly higher than you are currently using to switch the output on otherwise do not change the output.

If your output is currently on, compare your analog value with a reference value slightly lower than you are currently using to switch the output off otherwise do not change the output.

The difference in on and off reference value is called hysteresis ...

hope this helps, best regards
 

Thanks for your reply C-man.

It works as you explained.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…