added debugging stuff
changed to 32 bit timer for edge counting (TODO: zero error calibration)