Home/Support/Support Forum/getCounter incrementing by a value "2" not by "1"
Welcome to Digi Forum, where you can ask questions and receive answers from other members of the community.

getCounter incrementing by a value "2" not by "1"

0 votes
hello again,
i am sorry i had to revive this question once again,
the project i was working on has resumed again and im facing a problem with the getCounter() function;

i am using BL4S110 controller,
-jumper J13 is set to 2-4 (to ground)
-i am using IN1 as counter using the following command:
setCounter(1, BL_UP_COUNT, BL_EDGE_RISE, 0)
- i am reading the value of the counter using the following command: getCounter(1, &speed) (with "speed" defined as word).

i have a sensor connected to IN1 with supply of 12V taken from the BL4S110 itself and the 0VDC taken from the GND pin next to IN1.

the problem i am facing is that at every rising edge the counter is incrementing by 2 instead of 1.
why might this happen?
asked Jun 26, 2019 in Rabbit Software by Patchemaly New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
Can you put a scope or logic probe on that input and capture the signal? Is it possible that you're getting two rising edges instead of 1?

Are you checking the return value of setCounter() and getCounter() to verify that neither reports an error?

What's the sensor design? Is it possibly pulling that signal up when idle and then grounding it to generate a pulse? What voltage do you read on the pin when it isn't pulsing? Can you configure the sensor and IN1 with a pullup to +K and have the sensor pull it to ground?
answered Jun 28, 2019 by TomCollins Veteran of the Digi Community (1,681 points)
I was using a proximity switch that was counting the pulses and it seems that there is a problem with the sensor itself because once I used an inductive sensor of other brand it worked correctly and incremented by 1 on each detection (rising edge)