News:

  • August 22, 2026, 05:46:17 PM

Login with username, password and session length

Author Topic: Increase and decrease contacts  (Read 10019 times)

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Increase and decrease contacts
« on: May 26, 2018, 02:41:20 PM »
I love that delta contact to death.  Use it all the time, plus impress my friends who program other brands that don't have it.

Once in a while, I want to detect changes in a numerical register only in a single direction, so you might create delta/increase and delta/decrease contacts.  It'd be like leading and trailing edge contacts on a bit.  What you have to do now in ladder is slightly cumbersome (remember the previous value and compare each scan).  Not sure if users in general would find value in this.
« Last Edit: May 26, 2018, 03:05:24 PM by Controls Guy »
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: Increase and decrease contacts
« Reply #1 on: May 26, 2018, 02:52:15 PM »
The rising/falling edge equivalent of delta. Wouldn't be hard.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Increase and decrease contacts
« Reply #2 on: May 26, 2018, 04:24:48 PM »
How does delta work on a float, even the current bidirectional one?  Look for any change in the exponent or past some threshold in mantissa?
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: Increase and decrease contacts
« Reply #3 on: May 26, 2018, 04:44:38 PM »
How does delta work on a float, even the current bidirectional one?  Look for any change in the exponent or past some threshold in mantissa?

Simple integer compare of the raw bits. A directional version would require int/float awareness, but it isn't hard. The hardest part would be the 27 things that have to happen in DmD.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Increase and decrease contacts
« Reply #4 on: May 26, 2018, 06:14:42 PM »
Well, the inc/dec thing isn't a huge deal.  Nice to have, whenever it floats to the top of the list.

As a separate idea, though, you might think about upgrading the float implementation of delta.  Any change in exponent, or a significant change in mantissa*, or a sign change with a mantissa above a certain threshold. Could that be done entirely in DM firmware without changing DMD?  I guess the issue is that the compare still has to know it's looking at a float to invoke those rules.

*This implicitly makes the threshold relative to the magnitude so a larger number has to change more to kick the delta, plus still allowing an integer comparison rather than having to convert to a float and apply a comparison rule.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6172
  • Yes Pinky, Do-more will control the world!
Re: Increase and decrease contacts
« Reply #5 on: May 26, 2018, 06:18:32 PM »
It would be controller only, but we are very reluctant to change behavior in an instruction that isn't explicitly broken.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Increase and decrease contacts
« Reply #6 on: May 26, 2018, 06:40:35 PM »
Good point.  There may be people out there depending on it the way it is.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

Controls Guy

  • Internal Dev
  • Hero Member
  • ****
  • Posts: 3626
  • Darth Ladder
Re: Increase and decrease contacts
« Reply #7 on: May 26, 2018, 06:46:33 PM »
Maybe throw up a poll, and see what percentage would prefer which way.
I retract my earlier statement that half of all politicians are crooks.  Half of all politicians are NOT crooks.  There.

LWgreys

  • Hero Member
  • *****
  • Posts: 117
Re: Increase and decrease contacts
« Reply #8 on: June 02, 2018, 02:36:44 AM »
I say leave it alone. I do not want it changed. Because then I would have to modify my programs.

Now if you want to add a new contact then that's all right.