Papilio One : Flashing an LED at a specific frequency

To flash an LED at a specific frequency we need to divide the input clock frequency. In VHDL this can be done using counters. The Papilio One FPGA board comes with a 32MHz oscillator. 32Mhz means 32 million pulses per second, if you wanted to divide this down to 1Hz you could just set an output low, count 16 million pulses then set this output high and count 16 million pulses again. There ya have it! Any frequency you want can be had using this method (any frequency less than the input frequency anyway).

The formula for calculating the number of clock pulses you should count to get a certain frequency is given by :