hi all,
when using switches in flowcode 5 and clicking on ext properties for the switch, if a value is placed in the switch debounce box ie 100ms is this automatically put in the program you compile to hex so that if you build your project you will have a built in time delay for debounce, sorry about asking this in flowcode 4 but i cannot start a new topic in flowcode 5
switch debounce
-
- Posts: 392
- Joined: Wed Jan 05, 2011 11:24 am
- Has thanked: 101 times
- Been thanked: 24 times
- Contact:
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: switch debounce
Hi
I have moved that to general programming which you can access and has no problem with v4 or v5.
I have moved that to general programming which you can access and has no problem with v4 or v5.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: switch debounce
Hi
I have tried to see whether 100ms switch de-bounce in switch property has any effect in the c code or not. But unfortunately I can't see any effect there. I don't think Flowcode component property 100ms de-bounce will put that in hardware.
I have tried to see whether 100ms switch de-bounce in switch property has any effect in the c code or not. But unfortunately I can't see any effect there. I don't think Flowcode component property 100ms de-bounce will put that in hardware.
- Attachments
-
- SW.fcf
- (8 KiB) Downloaded 339 times
-
- 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: switch debounce
I seem to recall that debounce settings only worked with WaitUntillHigh & WaitUntillLow.
What I do with the switch is place in a loop with Loop count of 2.
Read switch, delay 5ms
So the switch is read twice.
Martin
What I do with the switch is place in a loop with Loop count of 2.
Read switch, delay 5ms
So the switch is read twice.
Martin
Martin
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
- Contact:
Re: switch debounce
Yes, you are right. It works for READ State as well. I have checked, in all three macro the c code is using the de-bounce delay.I seem to recall that debounce settings only worked with WaitUntillHigh & WaitUntillLow.
-
- 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: switch debounce
I have just completed a quick test.
Easiest way is to use ReadState of Switch component, and set debounce for approx half required value.
E.g If debounce is set for 2ms then it will take 4.7 ms for action to be taken.
Martin
Easiest way is to use ReadState of Switch component, and set debounce for approx half required value.
E.g If debounce is set for 2ms then it will take 4.7 ms for action to be taken.
Martin
Martin
-
- Posts: 392
- Joined: Wed Jan 05, 2011 11:24 am
- Has thanked: 101 times
- Been thanked: 24 times
- Contact:
Re: switch debounce
hi martin just to clarify if i use component macro for the switch and click on read state this will add my desired debounce time from the ext properties of the switch in my compiled code
bob
bob
-
- 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: switch debounce
Yes that is correct.siliconchip wrote:just to clarify if i use component macro for the switch and click on read state this will add my desired debounce time from the ext properties of the switch in my compiled code
The ReadState is accessed, then the next component will not be accessed until double the entered debounce time has elapsed
Enter 1/2 your desired time.
Martin
Martin