VHDL code for Clock Divider
For ex. If I want 1Hz freq. set the max count to i/p freq value viz.
1sec = 1Hz
Then, to get time period of 1sec i.e. 1 Hz frequency set max-count to 240000 as shown below:
1sec = 24000000 -- for i/p frequency of 24 MHz.
To get your desired frequency just calculate the maxcount with the formula given below:
max_count = 24000000 * (1/your required frequency)