Counter

Aus Ethersex_Wiki
Wechseln zu: Navigation, Suche


Impuls Counter mittels Control6 Script


Signal eingang am INT0 pin
Counter Abfrage mittels ECMD:

gummi:~# echo "c6 get pc_counter" | socat stdio tcp4:10.0.0.40:2701
pc_counter 98



CONTROL_START
        ECMD_GLOBAL(pc_counter, 0);
        ON STARTUP DO

                // Pullup Wiederstaende Aktivieren
                PORTD |= _BV(PORTD2);
                DDRD |= _BV(DDD2);
                PIND &= ~_BV(PIND2);

                _EIMSK |= _BV(PCINT0);
                _EICRA |= _BV(ISC01);
        END
CONTROL_END

ISR(INT0_vect)
{
        pc_counter ++;
}