LH79524/LH79525 User’s Guide
I
2
C Module
Version 1.0
9-3
9.1.1 Setting I
2
C Clock Timing
When the I
2
C Module is in Master mode, the serial clock (SCL) is generated from HCLK,
using two registers, ICHCNT and ICLCNT for timing parameters. When the I
2
C Module is
in Slave mode, SCL is provided by the Master.
The equation for calculating the proper number of HCLKs required for setting the proper
SCL clock HIGH and LOW period is:
HCNT = ROUND_UP (MIN_SCL_HIGH
time
× HCLK frequency) – k)
LCNT = ROUND_UP (MIN_SCL_LOW
time
× HCLK frequency) – k)
‘ROUND_UP’ means to round all fractions up to the next highest integer. The LOW count
is calculated in the same way.
Permissible values for the parameters in the equations are found inTable 9-1. Example
timing results appear in Table 9-2.
Table 9-1. I
2
C Clock Parameters
VALUE
400 kbit/s
100 kbits/s
k (constant)
4
3
MIN_SCL_HIGH
0.6
μ
s
4.0
μ
s
MIN_SCL_LOW
1.3
μ
s
4.7
μ
s
Table 9-2. Sample I
2
C HIGH Period Counts
I
2
C DATA
RATE (kbit/s)
HCLK (MHz)
SCL HIGH
REQUIRED MIN (
μ
s)
HCNT
SCL HIGH
TIME (
μ
s)
100
6.6
4
24
4.09
100
9.9
4
37
4.14
100
51.6
4
204
4.01
400
10.0
0.6
2
0.60
400
15.3
0.6
6
0.654
400
20.0
0.6
8
0.66
400
51.6
0.6
27
0.600