help with hysteresis

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 7.

Moderator: Benj

Post Reply
RLOPES780
Posts: 119
Joined: Tue Apr 07, 2015 11:01 am
Been thanked: 3 times

Re: help with hysteresis

Post by RLOPES780 »

I am using the ad of a pic 12F683 converter to read a sine wave.
At the bottom of senoid have 0,263 volts equals 54 bits, the upper part of senoid have 0,293 volts equals 60 bits.
Must have an exit in that when I have 0,263 volts equals 1 and when I have 0,293 volts equals 0. I made flowchart attached partially works responding between 0 and 1. However in a part of senoid he is cycling between 0 and 1.
I know that half of the wave is 0.278 volts equals 57 bits.
Then I have a minimum of senoid = 54; through the senoid = 57 and 60 = maximum senoid.
How do I create a hysteresis so that it recognizes approximately the minimum = 1 and max = 0 and let it be cycling in the state of change interval.
I have attached the code if someone can help demonstrating that the attached code appreciate.

Grateful;

Ricardo.
Attachments
Flowcode1.fcfx
(8.92 KiB) Downloaded 203 times

medelec35
Matrix Staff
Posts: 9521
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times

Re: help with hysteresis

Post by medelec35 »

Hi Ricardo,
One serious issue with EEPROM is they have a finite amount of times they can be read or written to before it wears out.
Your EEPROM was constantly written to very rapidly.
With that in mind I have change your flowchart.
Hopefully its what you want?
I have modified it so when ADC value is greater then 59 then the output is 0.
The output don't change to 1 until ADC is less than 54, therefore adding hysteresis.
Try to avoid goto's if you can.

Martin
Attachments
Flowcode2.fcfx
(9.89 KiB) Downloaded 205 times
Martin

Post Reply