The 74hc/hct4059 is a programmable divide-by-n counter that can be programmed to divide an input frequency by any number (n) from 3 to 15999. There are four operating modes: timer, divide-by-n, divide-by-10000 and master preset, which are defined by the mode select inputs (Ka to Kc) and the latch enable input (LE) as shown in the Function table. The complete counter consists of a clock generator, a programmable counter and a latch. The clock generator is constructed using D flip-flops, whose output frequency is 1/2 of the clock frequency. The programmable counter is made up of four 14-bit Johnson counters, whose outputs are latched in the latch to form the master counter's output.