The timer peripheral is used to generate time bases by counting up or down from 0 to a programmed value. It has a 16-bit counter register that counts up/down at a rate determined by the timer clock frequency and a programmable prescaler value. The prescaler divides the timer clock to produce the counter clock. The auto-reload register determines the period of the time base by reloading the counter when it reaches this value, restarting the counting cycle. This allows the timer to generate periodic interrupts or trigger events at the programmed time intervals.