Event Conter counts external events on pin PTD4. When 1000 events are detected counter is reseted.