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
E-Blocks 2 settings
-
- Posts: 16
- http://meble-kuchenne.info.pl
- Joined: Thu Dec 17, 2020 3:25 pm
- Been thanked: 2 times
-
- Matrix Staff
- Posts: 1560
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 555 times
- Been thanked: 514 times
Re: E-Blocks 2 settings
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.
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
Re: E-Blocks 2 settings
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?
Please let me know your opinion.
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?
Please let me know your opinion.
- Attachments
-
- Counter Interups V002.fcfx
- (32.45 KiB) Downloaded 198 times
-
- Counter Interups V001.fcfx
- (29.81 KiB) Downloaded 191 times
-
- Matrix Staff
- Posts: 1560
- Joined: Wed Dec 02, 2020 11:07 pm
- Has thanked: 555 times
- Been thanked: 514 times
Re: E-Blocks 2 settings
Hello.
This is the debounce routine for the switch read functions: 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
This is the debounce routine for the switch read functions: 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