using a frequency divider or counter in the loop