16 SEVEN-SEGMENT LED CONTROLLER (LEDC)
S1C17M12/M13 TECHNICAL MANUAL
Seiko Epson Corporation
16-3
(Rev. 1.2)
16.3.3 Clock Supply in DEBUG Mode
The CLK_LEDC supply during DEBUG mode should be controlled using the LEDCCLK.DBRUN bit.
The CLK_LEDC supply to LEDC is suspended when the CPU enters DEBUG mode if the LEDCCLK.DBRUN
bit = 0. After the CPU returns to normal mode, the CLK_LEDC supply resumes. Although LEDC stops operating
when the CLK_LEDC supply is suspended, the registers retain the status before DEBUG mode was entered. If the
LEDCCLK.DBRUN bit = 1, the CLK_LEDC supply is not suspended and LEDC will keep operating in DEBUG
mode.
16.3.4 LED Lighting Cycle
The LEDC asserts a signal for the period set using the LEDCLPSET.LICLKDIV[7:0] bits to light the LED module
of the corresponding digit. This operation is performed for the number of display digits set using the LEDCCTL.
NDIGITS[2:0] bits by switching the COM signals sequentially (refer to “Drive Waveform”). The dynamic lighting
is archived by repeating this operation.
Use the following equations to calculate the lighting period (COM signal active period) and lighting cycle of each
LED module (each digit).
(LI 1)
×
8
LP = ————————————
(Eq. 16.1)
f
CLK_LEDC
LC = LP
×
(N 1)
(Eq. 16.2)
Where
LP:
Lighting period of each COM (digit) [s]
LC:
Lighting cycle of each COM (digit) [s]
f
CLK_LEDC
: LEDC operating clock frequency [Hz]
LICLKDIV: LEDCLPSET.LICLKDIV[7:0] setting value (0 to 255)
NDIGITS: LEDCCTL.NDIGITS[2:0] setting value (0 to 7*)
*
The maximum value depends on the model.
Example)
LEDCCLK.CLKSRC[1:0] bits = 0x2
(OSC3, 16 MHz = 62.5 ns)
LEDCCLK.CLKDIV[2:0] bits = 0x1
(Dividing into 1/32)
→
1/f
CLK_LEDC
= 2 [
µ
s]
LEDCLPSET.LICLKDIV[7:0] bits = 0x22 (34 = Dividing into 1/35)
→
LP = 560 [
µ
s]
LEDCCTL.NDIGITS[2:0] bits = 0x4
(5-digit display)
→
LC = 2,800 [
µ
s]
16.4 Operations
16.4.1 Initialization
The LEDC should be initialized with the procedure shown below.
1. Assign the LEDC output function to the ports. (Refer to the “I/O Ports” chapter.)
2. Configure the LEDCCLK.CLKSRC[1:0] and LEDCCLK.CLKDIV[2:0] bits. (Configure operating clock)
3. Configure the following LEDCCTL register bits:
- Write 1 to the LEDCCTL.MODEN bit.
(Enable LEDC operating clock)
- LEDCCTL.CMOFFMOD bit
(Set driver state at COM off time)
- LEDCCTL.SGOFFMOD bit
(Set driver state at SEG off time)
- LEDCCTL.COMMOD bit
(Select common mode)
- LEDCCTL.BRITCNT[1:0] bits
(Adjust brightness)
- LEDCCTL.NDIGITS[2:0] bits
(Select number of display digits)
4. Set the LEDCLPSET.LICLKDIV[7:0] bits.
(Set LED lighting period)
5. Write display data to the LEDCDAT
**
registers.