beautypg.com

Texas Instruments MSC1210 User Manual

Page 70

background image

System Timers

7-6

7.2.1

Microseconds Timer

The microseconds timer is used by the MSC1210 in order to establish a 1

µ

s

clock. This clock, in turn, is used by flash memory to establish timing for flash
writes, as well as by the PWM module.

The USEC (FB

H

) SFR should be set to a value such that the system clock divid-

ed by the value of this SFR, plus one, generates a 1

µ

s clock. For example, given

a system clock of 12.000MHz, USEC should be set to:

12 000 000/1 000 000 = 12 – 1 = 11.

Therefore, for a 12.000MHz system clock, USEC should be set to 11 to generate
a 1

µ

s clock.

In reality, the USEC SFR may be set to a value that produces a clock that is
something other than 1

µ

s. This works fine as long as the other two timers that

depend on the USEC SFR are adjusted accordingly.

7.2.1.1

PWM Clock

The PWM module may use the microseconds timer as its input clock. By clear-
ing SPDSEL (PWMCON.3), the input clock for the PWM module will be the mi-
crosecond timer. This creates a 1MHz input clock for the PWM module, as-
suming the microseconds timer is correctly configured to produce a 1

µ

s clock.

In this case, the microseconds clock is further divided by the value contained
in the PWMHI/PWMLOW SFRs.

7.2.1.2

Flash Write Timing

The microseconds clock is further used to establish the flash memory write timing.
The flash write timing uses the microsecond clock as an input clock and then fur-
ther divides it by the value of FTCON[3:0] to generate a flash write clock. The flash
write clock must be between 30

µ

s and 40

µ

s for flash writing to operate properly.

Specifically, FTCON[3:0] + 1, multiplied by five, multiplied by the frequency of the
microsecond clock, should produce an appropriate flash write timer (30

µ

s to 40

µ

s).

Assuming USEC is set to generate a correct 1

µ

s clock, FTCON[3:0] should be

set to 5, 6, or 7. If FTCON[3:0] is 6, then (6 + 1)

S

5 = 35

µ

s, which is right in the

middle of the expected range.

7.2.2

Milliseconds Timer

The milliseconds timer is used by the MSC1210 in order to establish a millisec-
ond clock. This clock, in turn, is used as a base for establishing flash erase tim-
ing, the milliseconds interrupt, the seconds interrupt, and to establish timing
for the watchdog timer.