Momentary contact switches and UI Inputs

This is a follow up to a previous topic (Troublshooting / momentary switch pulse detection) from Sept 2018. Rather than re-activate the old post I have started a new one.

I have found the same issues in Feb 2023 with my T3-BB. The ~1sec scan time means that short momentary switch operations are missed with regular Input/Digital setting.

Has this issue been fixed?

I dont seem to get any useful operation with the Input/Pulse count 1Hz setting, or with the “high speed inputs” (29-32) - no apparent recognition of the input. I have followed the suggestions in the earlier post.

Taking a step back, why is the scan time so long? There must be a lot of "“deliberate slowing down”. Other controllers I have worked on with very large progams have scan times <50ms

One small detail - there are no GND terminals for UI31 & UI32 on the T3-BB. Do I just connect to the other (eg UI30) input GND terminals?

Again - I appreciate any assistance.

1 Like

Have you tried the IF+ statement, this has been good at catching keypresses from the early days, no matter the hardware version.

The later hardware has dedicated inputs for high speed counters but that is a separate dscussion. All UI inputs can do actions from a momentary switch using the IF+ statement.

Standing by to help.

1 Like

Thanks again Maurice.

I am just getting started but have already (and only) used the IF+ statement. eg

10 IF+ IN1 THEN COUNT = COUNT + 1
20 IF+ IN1 THEN DO1 = NOT DO1

I monitor the variable COUNT on Variables page. This all works, as long as I press the switch long and slowly…

I seem to need to LONG-press the switch for about 1 sec - until I see the input LED change state - before the count will increment.
If I short-press (same as with any normal button - like a phone) it doesnt register.
It works reliably if I time my switch-presses from the heartbeat LED - ie press mississippi off mississippi press mississippi off.

(I realise that it takes a very long time for COUNT to update on the Variables page - but I keep a score in my head then wait.)

I dont know if/how the Filter setting affects digital inputs. I have tried various Filter settings 1, 2, default 5 but no difference observed. (It didnt work at all with Filter=0.)

I dont have very many momentary switches to handle thankfully - I think I need none!

FYI I have updated both software and firmware.

I would appreciate your input.

Cheers

Brian

1 Like

I have made some further tests:
Controller: T3-BB (1 month old) - Software & Firmware updated
Code:
10 IF+ IN30 THEN COUNT = COUNT + 1
20 IF+ IN30 THEN OUT1 = NOT OUT1

Input 30 (high speed) has a momentary push-switch, NO contact

Experiment 1: define IN30 range as DIGITAL 1 off/on, Filter = 1,
Pressing switch briefly - no response. IN30 LED remains on.
Long press (ie wait until IN30 LED goes off) works OK, COUNT increments, OUT2 toggles

Experiment 2: define IN30 range as Analog 55 - Pulse Count Fast, (Analog 45 Pulse Count Slow is greyed-out) Filter = 1
Pressing switch - quickly or slowly - COUNT variable does not increment, OUT2 does not toggle. I note that Input “Value” increments correctly - with short, but well spaced switch-presses. However, if I press the switch briefly at approx 2Hz the Value count increases much more than the number of switch-presses (eg 5 quick presses increases value by 45). Value also increases with no button presses.

Experiment 3: define IN30 range as Analog 55 - Pulse Count Fast, Filter = 5.
Unstable result. eg 1 switch-press causes value to increase 10 counts, then hundreds of counts without any switch-press.

Experiment 4: define IN10 (low speed input) range as Analog 45 - Pulse Count Slow, Filter = 1
Input Value increases with slow (0.5Hz) operation of switch - as per digital & variable COUNT in Experiment 1. No apparent phantom counts.

In all cases there is a significant delay before the Input Table Value updates. I presume the value in the input table will appear in any code location with IN30 - will this also be subject to refresh delay?

In summary, neither low nor high speed inputs appear capable of reliably counting (a) short switch-press, nor (b) any stream of switch-based pulses faster than 0.5Hz.

Am I doing something wrong with settings etc?

1 Like

I will get the team to check this and report back shortly. Really, last time we dug into short keypresses is when we made that table with high & low speed minimum time ons. I am pretty sure with the latest T3-BB you will see some good performance. On older ones from 2018… ok, they may be slow to respond.

1 Like

It is possible that I have used an incorrect UI setting. It might help to pedantically review ALL the input settings (eg filter) that I should be using and a code example. These are not explained very well in documentation. For example it is not actually explained that the value of the input count should be taken from the input value field, rather than from an external accumulator.

Brian Furness

(PS been off-line past week with covid)

I’m not clear what you mean about the value and the accumulator.

Maurice

Maurice,
I want to count the number of switch-closures/pulses into an accumulator for various purposes.

For long, slow-speed pulses, I configure the UI as a digital input on/off (eg type 12), then use an IF+ statement to increment the accumulator.

For short, high-speed pulses I am supposed to configure the UI as an analog input (eg type 55). This type of input is incompatible with IF+ statement.
Instead, it seems from my experiments (not explained anywhere in documentation) that the cumulative count of pulses is found in the “value” field.

The high-speed analogue type55 input seems to be intended for regular/repetitive pulse streams with short on-time. My situation features a (relatively) short-duration but irregulrly-timed or intermittent, one-time pulses (pulse length <100ms - pretty slow really). I speculate the distinction between one-time fast pulses and repetitive fast pulse is significant.

I dont seem to be making very fast progress in resolving this topic. Based on my experiments, maybe I just have to abandon using the T3 for this particular input-type and move-on with other aspects of my project.

Regards

Brian Furness

The input needs to be an on-off range for the IF+ statement to work, sure.

You can use a UI or a high speed input, either will work fine with the IF+ statement.

I am still not clear what you mean about the value and the accumulator but in short, you configure the input as ON-OFF type. Then you use a small program to count them and add the total in a VAR.

10 IF+ IN1 THEN VAR1 = VAR1 + 1.

To read the value of var1, you just read it like any normal analog variable… or if you are reading from an external system you can read VAR1 as a bacnet AV or modbus register.

Maybe I am missing something in what you are trying to do but at first glance it seems like a pretty straightforward application to count pulses on one of the inputs. Here’s a link to the specs of the inputs and how long the pulse needs to be, its 0.01 second for the high speed inputs and 0.5 seconds on the regular UIs.

1 Like

Thank you. I will try this and advise how I get on. You are right, it is a very straightforward application.

My interest in/reference to “value” arises simply because, in the input table, one of the columns is headed “Value”." Since you have called it Value, I do too! It’s not a mystery term I invented myself.

If I select an input as type 45 or 55 the “value” cell in the table reflects an accumulation of pulses received by input. For type 55, the “value” shown is poorly correlated with the number of pulses received - large increment in “value” with few pulses.

See how I go…

Brian

I see what you are referring to now, the pulse counter ranges. Got it.
If you’re having trouble with that range then sure, try the ON-OFF ranges and the small program shown. Both methods should work but the small program and a separate VAR gives you more control. For example you can do some logic at the end of the month to store VAR1 into a separate VAR2 and reset VAR1 to zero.

image

1 Like