I was wondering if anyone has implemented software hysteresis into their designs?
To explain, I have a project where I read an ADC and send the results to a bar graph and a string on a ViSi display. The ADC is very stable but when the ADC reading is on the cusp of changing the graph and string to another value, the display is a blur of activity between the old and new readings until the value read from the ADC is firmly in the middle of the appropriate range.
I don’t want to slug the response by slowing down the ADC read cycle so I'm thinking that with a bit of hysteresis (similar to a Schmitt input in hardware) this will solve the problem but my problem is I haven’t the software skills to come up with a solution.
Any ideas would be greatly appreciated
Thanks
Chris
Software Hysteresis
Moderator: Benj
-
- Posts: 55
- Joined: Tue Apr 01, 2014 9:10 am
- Has thanked: 16 times
- Been thanked: 18 times
- Contact:
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Software Hysteresis
Hi Chris,
Here is a basic way of software hysteresis.
To open FC5 flowchart.
Select Open project, change dropdown box next to File Name to Flowcode for PIC files (*.fcf)
Edit:
Thinking about it My post a couple below this post maybe more suited for your application
Here is a basic way of software hysteresis.
To open FC5 flowchart.
Select Open project, change dropdown box next to File Name to Flowcode for PIC files (*.fcf)
Edit:
Thinking about it My post a couple below this post maybe more suited for your application
Last edited by medelec35 on Sat Aug 11, 2018 10:21 am, edited 1 time in total.
Reason: Added reference to another post.
Reason: Added reference to another post.
Martin
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Software Hysteresis
Hi Chris,
Another method, i have used in a project
https://www.matrixtsl.com/wikiv7/index. ... _component
scroll down to the section
"Filtering ADC Inputs"
Hope this helps
Steve
Another method, i have used in a project
https://www.matrixtsl.com/wikiv7/index. ... _component
scroll down to the section
"Filtering ADC Inputs"
Hope this helps
Steve
Success always occurs in private and failure in full view.
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Software Hysteresis
I thought of a different way which will give instantaneous results if ADC changes by more then 2.
The 2 can be changed to any suitable amount of course.
Just Select View, Analogue Inputs.
Single step by pressing F8.
Observe the ADC variable within Debug window:
The 2 can be changed to any suitable amount of course.
Just Select View, Analogue Inputs.
Single step by pressing F8.
Observe the ADC variable within Debug window:
- Attachments
-
- ADC Filter.fcfx
- (8.71 KiB) Downloaded 252 times
Martin
-
- Posts: 55
- Joined: Tue Apr 01, 2014 9:10 am
- Has thanked: 16 times
- Been thanked: 18 times
- Contact:
Re: Software Hysteresis
Thanks guys, much appreciated. Wish I was this skilled in software – I’m a hardware man by profession.
Chris
Chris
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Software Hysteresis
Hi Chris,
Hopefully you will find the solution for your application.
Would you mind letting us know which solution suited you best,
as there will be other Flowcode users looking for a similar answer.
Thanks.
Hopefully you will find the solution for your application.
Would you mind letting us know which solution suited you best,
as there will be other Flowcode users looking for a similar answer.
Thanks.
Martin
-
- Posts: 55
- Joined: Tue Apr 01, 2014 9:10 am
- Has thanked: 16 times
- Been thanked: 18 times
- Contact:
Re: Software Hysteresis
No problem.
I had already applied the low pass filter that Steve highlighted and that resulted in a very stable ADC in a very noisy electrical environment but that alone didn’t stop the digital display constantly updating right on the point of a change in value.
As a result I applied your second suggestion (ADC Filter.fcfx). I modified it a bit because I’m reading the ADC as an INT and a change in computed value needed a jump of 10 from the ADC. After application (I’m still using the low pass filter because of the noise (it’s a motorbike dashboard and the supply is awful with the engine running) the display changes with a flip and doesn’t “hunt” anymore – just what I was looking for.
Many thanks again to you and Steve, I’m learning all the time
Chris
I had already applied the low pass filter that Steve highlighted and that resulted in a very stable ADC in a very noisy electrical environment but that alone didn’t stop the digital display constantly updating right on the point of a change in value.
As a result I applied your second suggestion (ADC Filter.fcfx). I modified it a bit because I’m reading the ADC as an INT and a change in computed value needed a jump of 10 from the ADC. After application (I’m still using the low pass filter because of the noise (it’s a motorbike dashboard and the supply is awful with the engine running) the display changes with a flip and doesn’t “hunt” anymore – just what I was looking for.
Many thanks again to you and Steve, I’m learning all the time
Chris
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
Re: Software Hysteresis
Thanks for the update Chris.
I'm glad the combination is working for you.
I'm glad the combination is working for you.
Martin
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: Software Hysteresis
Hi Chris,
Glad the combination working. If your interested see this post for an explanation to how it works
Scroll down to Bens Answer
viewtopic.php?f=63&t=20008#p87554
Steve
Glad the combination working. If your interested see this post for an explanation to how it works
Scroll down to Bens Answer
viewtopic.php?f=63&t=20008#p87554
Steve
Success always occurs in private and failure in full view.