E-Blocks 2 settings

For general Flowcode discussion that does not belong in the other sections.
Post Reply
walbeek
Posts: 16
http://meble-kuchenne.info.pl
Joined: Thu Dec 17, 2020 3:25 pm
Been thanked: 2 times

E-Blocks 2 settings

Post by walbeek »

Hi there,

I have made a counter program with interupts on the inputs.
In simulation modes the program works well.
When programmed in the e-blocks BL0080 programmer, the switches don't work very well.
When pushed once, the counter changes with more than one in most cases.
The debounce of the switches is set to 40ms but there seems to be no change.
Can anybody give me some tips on this?
Maybe something like edge-detection instead of debounce?
Please let me know.

Rinie

mnfisher
Valued Contributor
Posts: 953
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 507 times

Re: E-Blocks 2 settings

Post by mnfisher »

If you post your chart - someone will surely be able to help...

Martin

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: E-Blocks 2 settings

Post by medelec35 »

Hello
As a general rule the debounce will only work if you use the function of the switch e.g ReadState.
If you use the Input command icon then there will be no debounce function.

I thought I would mention this for anyone who has a similar issue.

Following Martins (mnfisher) advice is what I would recommend.
Martin

walbeek
Posts: 16
Joined: Thu Dec 17, 2020 3:25 pm
Been thanked: 2 times

Re: E-Blocks 2 settings

Post by walbeek »

Hi there,

Yesterday I have tried to post an update but it seems to be disappeared.
I read about the debounce only be available with the Component Macro's.
So I did change the buttons macro to that.
In the attachment are the old (V001 - Input) and new (V002 - Macro) versions.
However, I still have mistakes in the counting.
I have put the debounce time on 40mS and later 100mS.
Still, every fourth or fifth time the value changes with more than one.
In the V002 version I have also included "Wait Until Low"
In an older program I checked an input and waited a while.
Than check it again and if it's still high, than react.
This was meant to avoid spikes but it might be better do debounce?

debounce.jpg
debounce.jpg (26.41 KiB) Viewed 167 times
Please let me know your opinion.
Attachments
Counter Interups V002.fcfx
(32.45 KiB) Downloaded 10 times
Counter Interups V001.fcfx
(29.81 KiB) Downloaded 10 times

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: E-Blocks 2 settings

Post by medelec35 »

Hello.
This is the debounce routine for the switch read functions:
Debounce.png
Debounce.png (54.98 KiB) Viewed 159 times
if you believe the debounce is not working then we will investigate further.
You need to rememberr that the code within a microcontroller is accessed so fast, delays or WaitUntilHigh or WaitUntilLow (depending on the polarity.), will be required to prevent switch being read too quickly
Martin

Post Reply