NXP Semiconductors | UM10301 |
| User Manual PCF85x3, PCA8565 and PCF2123, PCA2125 |
12.3 Setting the timer
The internal timer is an
This example for the PCF8563 generates an interrupt after 10 ms:
•Clock to be used 4096 Hz;
•Number of clock pulses needed = 0.01 x 4096 = 40;
•Error = 40 / 4096 Hz – 0.01 =
•Length of
•The timer is started by the acknowledge of the start timer instruction.
Table 7. Setting the timer
Sequence of commands / data to be sent
Binary (BCD) | HEX | Register | |
|
|
| Address |
|
|
|
|
|
|
|
|
1 0 1 0 | 0 0 1 0 | A2 |
|
|
|
|
|
0 0 0 0 | 0 0 0 1 | 01 |
|
|
|
|
|
0 0 0 0 | 0 0 0 1 | 01 | 01 |
|
|
|
|
|
|
|
|
1 0 1 0 | 0 0 1 0 | A2 |
|
|
|
|
|
0 0 0 0 | 1 1 1 1 | 0F |
|
|
|
|
|
0 0 1 0 | 1 0 0 0 | 28 | 0F |
|
|
|
|
|
|
|
|
1 0 1 0 | 0 0 1 0 | A2 |
|
|
|
|
|
0 0 0 0 | 1 1 1 0 | 0E |
|
|
|
|
|
1 0 0 0 | 0 0 0 0 | 80 | 0E |
|
|
|
|
Comments
generate I2C start condition I2C slave address, write
word address 1 (control/status register 2) clear all flags, enable timer interrupt generate I2C start condition (repeated start) I2C slave address, write
Word address 0FHEX for timer value Timer value set to 40, 28HEX
generate I2C start condition (repeated start) I2C slave address, write
word address OE for timer control byte
Select clock frequency 4096 Hz and start timer generate I2C stop condition
Refer to chapter 17 “First period inaccuracy when using the timer” for further details on timer operation.
UM10301_1 |
| © NXP B.V. 2008. All rights reserved. |
User manual | Rev. 01 — 23 December 2008 | 29 of 52 |