At that time, is it necessary to disable interrupts? [2005/12/01]
Since access by the user program is in 8-bit units, you need to access both the high and low timer registers.
- Accessing the timer registers
- Timer register (low) : latch to intermediate buffer
Timer register (high) : latch to intermediate buffer; 16-bit data is latched from intermediate buffer or transferred to counter
- <Reading >
- Timer register (high) : transfer 16-bit data from counter to intermediate buffer and read from intermediate buffer
Timer register (low) : read from intermediate buffer
As seen above, the presence of an intermediate buffer makes disabling interrupts during each timer register access unnecessary.
Reason for intermediate buffer
When accessing while the timer is in operation without an intermediate buffer, there is a difference in access time between the high and low timer registers, during which the timer counter may advance. If that happens, expected setting or read values will not be obtained. In order to avoid this sort of problem, the timer registers are accessed in 16-bit units via an intermediate buffer.