First of all sorry for the english it comes from google.
Now to my problem.
I have a Metrix Ni3 pickup for my gas meter. Unfortunately I can't get it to read it properly. He always tells me too much. Opposite the counter of the gas meter. I've tried quite a few things. Debounce to 32000 but also to 3msc. But I've tried a few things in between. I've read that I can also trim it moderately with software. With which he queries the status more precisely and only lets a signal through. I think he bounces. I would hate to do it with a hardware solution. But I don't know how I should manage it via the software solution. I'm a total novice when it comes to ESBEasy. I've read posts, but don't understand how to implement it. I already unlocked Rules.
viewtopic.php?p=52594&hilit=pulse+Count ... lem#p52594
I also read this article and that's why I'm invited here.
https://www.mikrocontroller.net/articles/Entprellung
I read this too. But where and how do I have to enter my D2 pin there?? Or do I need that at all? I have this software on my D1 mini 4MB (Git-Build: mega-20211224_f162ebf )
I just do not get any further.
this seems to me to be the right one, but how do I insert it correctly? Where do I have to enter my D2 if I still need it at all??
Thanks in advance for your help#define TASTERPORT PINC
#define TASTERBIT PINC1
char taster(void)
{
static unsigned char zustand;
char rw = 0;
if(zustand == 0 && !(TASTERPORT & (1<<TASTERBIT))) //Taster wird gedrueckt (steigende Flanke)
{
zustand = 1;
rw = 1;
}
else if (zustand == 1 && !(TASTERPORT & (1<<TASTERBIT))) //Taster wird gehalten
{
zustand = 2;
rw = 0;
}
else if (zustand == 2 && (TASTERPORT & (1<<TASTERBIT))) //Taster wird losgelassen (fallende Flanke)
{
zustand = 3;
rw = 0;
}
else if (zustand == 3 && (TASTERPORT & (1<<TASTERBIT))) //Taster losgelassen
{
zustand = 0;
rw = 0;
}
return rw;
}
Eine Erweiterung, damit beliebig lange das Halten einer Taste erkannt wird kann man ganz einfach so implementieren:
// zustand kann entweder zum ersten mal als gehalten detektiert werden oder aber jedes weitere mal
else if (((zustand == 1) || (zustand == 2)) && !(TASTERPORT & (1<<TASTERBIT))) //Taster wird gehalten
{
zustand = 2;
rw = 0;
}