Digital Clock using Timer
Timer is a Hardware circuit used to measure regular clock pulses.Timer can be used to generate appropriate (known) amount of delay. Timer can be used to create Digital clock.
Programming Timer requires knowledge of its internal registers.
Prescaler Register (PR): To set division factor of clk
Prescaler : Divides clock by PR+1
Timer Control Register: To control Operation of Timer
Timer/Counter: 32 bit up counter increments for every (PR+1) clk cycles.
Match Control Register: To set one of three possible operations on Match (1.Stop Timer, 2. Generate Interrupt, 3. Reset Timer on Match)
Match Register: To set Delay of Timer.
If Timer operates at 9MHz then for 1sec delay values to be loaded into Match Registers is (9000000)
Clock with Seconds which should increment till 59 and then roleback to zero.
Minutes which should increment till 59 and then roleback to zero.
Hours which should increment till 23 and then roleback to zero.
Hardware Timer is made up of set of registers, applied clock is passed through Prescaler
Prescaler Register (PR): To set division factor of clk
Prescaler : Divides clock by PR+1
Timer Control Register: To control Operation of Timer
Timer/Counter: 32 bit up counter increments for every (PR+1) clk cycles.
Match Control Register: To set one of three possible operations on Match (1.Stop Timer, 2. Generate Interrupt, 3. Reset Timer on Match)
Match Register: To set Delay of Timer.
If Timer operates at 9MHz then for 1sec delay values to be loaded into Match Registers is (9000000)
download code
No comments:
Post a Comment