implemented frequency measurement