It's not a mechanical switch connection.  The XHC pendant has a wireless 
keyboard interface chip inside it.  That is correctly debounced already, 
your PC keyboard does not require a debounce driver installed on the PC 
side to filter keypresses- that's done on the HW side.  It really has to 
be, it's difficult to do a correct debounce after traveling through a 
packet-based wireless interface.  I did put it on HALScope and no matter 
how you press that button, you get a single nice clean press.

BTW, I wanted to say- the "debounce" HAL component does not seem correct 
to me.  It requires a signal to be stable for N cycles before the output 
takes the new value.  That's a undesirable delay, and can fail to 
register quick presses.

Rarely do you want that.  Rather, you designate the actuation level- say 
that's "high".  It responds to that immediately, makes the output high, 
and starts the debounce1 interval.  Within the debounce1 interval, the 
output will remain high regardless of what the input does.

When the debounce1 interval ends, it waits for the input to be low.  
Whether it's already low at the end of the debounce1 interval or has to 
wait for it, when it reads as low, it immediately turns its output low 
but there is a second low-to-high debounce2 interval which may be of a 
different length of time, during which time it ignores changes in the 
input.  At the end of the debounce2 interval, it is reset and waiting 
for the next high level on the input.

If the input is already high at the end of debounce2, that registers as 
a new press.  So it turns the output high and begins debounce1 period.

There are cases where you DO want to ignore short noise pulses. That's 
for noise.  But switch bounce is NOT regular noise.  In general you want 
to respond to switch signals immediately, you just don't want to 
register the spurious off/on/off/on bouncing of a switch as it actuates 
as additional commands.

Some momentary-on switches DO bounce as they're released.  It's 
typically not nearly as long but still you don't want to register it.  
And not all switches are momentary-on.  That is, you could have an NC 
switch with a pullup resistor.  It is normally low and when actuated it 
goes high, which is the same active-high input. However, it will bounce 
very little when the pressed but bounce much longer when released.  So 
the debounce intervals need to be configured independently.

I don't see any HAL component for this.  What's it take for me to write 
a new HAL component?  What language are those in?

Would probably follow the "filter/<F>/in group/<G>/" organization of 
debounce.  It would need the active level provided as a parameter, and 
the debounceOn/debounceOff as two different parameters.  Or, probably 
makes more sense to have debounceRising/debounceFalling so the whole 
perspective doesn't turn upside down when we change the active level.

Danny

On 4/24/2016 6:08 AM, Gene Heskett wrote:
> On Sunday 24 April 2016 03:49:15 Danny Miller wrote:
>
>> Perfect!  Thanks!
>>
>> Danny
> I would go one step farther in terms of noise proofing it, and put a
> debounce module in front of the edge module, with its debounce set for 2
> or 3 so that a random noise spike would not normally last long enough to
> allow it thru to the edge module.  If its in the servo-thread, and the
> servo-thread is running at the 1 millisecond default, that would still
> only be a 3 millisecond lag, but it might save you some surprises.
>
> Remember also, that in time critical operations, that the order of
> execution IS the order of the addf list section in your hal file(s).
> That can be used in reverse to advantage for certain functions, such as
> filtering an A/B/X encoders quadrature errors by doing a running average
> of the last 4 edges to go by.  This, when applied to the spindle
> encoders output, allows higher Pgain in the spindle PID, stiffening the
> speed vs load considerably on those machines that I have spindle
> encoders in.
>
>> On 4/24/2016 2:07 AM, Philipp Burch wrote:
>>> Hi Danny!
>>>
>>> On 24.04.2016 08:37, Danny Miller wrote:
>>>> [...]
>>>>
>>>> So I need like an edge detector that provides only a pulse for one
>>>> cycle when the button is pressed.  That seems simple enough, but I
>>>> don't see any HAL construct which supports it.
>>>>
>>>> [...]
>>> There is an "edge" component, which should do just what you need:
>>> http://linuxcnc.org/docs/2.6/html/man/man9/edge.9.html
>>>
>>> Bye,
>>> Philipp
>>>
>>>
>>>
>>> --------------------------------------------------------------------
>>> ---------- Find and fix application performance issues faster with
>>> Applications Manager Applications Manager provides deep performance
>>> insights into multiple tiers of your business applications. It
>>> resolves application problems quickly and reduces your MTTR. Get
>>> your free trial!
>>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
>>>
>>>
>>> _______________________________________________
>>> Emc-users mailing list
>>> Emc-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/emc-users
>> ----------------------------------------------------------------------
>> -------- Find and fix application performance issues faster with
>> Applications Manager Applications Manager provides deep performance
>> insights into multiple tiers of your business applications. It
>> resolves application problems quickly and reduces your MTTR. Get your
>> free trial!
>> https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
>> _______________________________________________
>> Emc-users mailing list
>> Emc-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/emc-users
>
> Cheers, Gene Heskett

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Emc-users mailing list
Emc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/emc-users

Reply via email to