Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic 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.

Register Log in

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?
 

C-Man

Advanced Member level 4
Joined
Jul 19, 2001
Messages
1,059
Helped
90
Reputation
180
Reaction score
17
Trophy points
1,318
Activity points
10,191
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
 

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
Thanks for your reply C-man.

It works as you explained.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top