DRAFT
DRAFT DRAFT DR
DRAFT DRAFT DRAFT
D
RAF
DRAFT DRAFT DRA
FT D
RAFT DR
AFT D
DRA
FT DRAFT DRAFT
D
RAFT
DRAFT
D
RAFT
DRA
UM10601
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2012. All rights reserved.
Preliminary user manual
Rev. 1.0 — 7 November 2012
137 of 313
NXP Semiconductors
UM10601
Chapter 10: LPC800 State Configurable Timer (SCT)
10.7.9.4 Configure multiple states
1. In the EVn_STATE register for each event (up to 6 events, one register per event),
select the state or states (up to 2) in which this event is allowed to occur. Each state
can be selected for more than one event.
2. Determine how the event affects the system state:
In the EVn_CTRL registers (up to 6 events, one register per event), set the new state
value in the STATEV field for this event. If the event is the highest numbered in the
current state, this value is either added to the existing state value or replaces the
existing state value, depending on the field STATELD.
Remark:
If there are higher numbered events in the current state, this event cannot
change the state.
If the STATEV and STATELD values are set to zero, the state does not change.
10.7.9.5 Miscellaneous options
•
There are a certain (selectable) number of capture registers. Each capture register
can be programmed to capture the counter contents when one or more events occur.
•
If the counter is in bidirectional mode, the effect of set and clear of an output can be
made to depend on whether the counter is counting up or down by writing to the
OUTPUTDIRCTRL register.
10.7.10 Run the SCT
1. Configure the SCT (see
Section 10.7.9 “Configure the SCT”
2. Write to the STATE register to define the initial state. By default the initial state is state
0.
3. To start the SCT, write to the CTRL register:
–
Clear the counters.
–
Clear or set the STOP_L and/or STOP_H bits.
Remark:
The counter starts counting once the STOP bit is cleared as well. If the
STOP bit is set, the SCT waits instead for an event to occur that is configured to
start the counter.
–
For each counter, select unidirectional or bidirectional counting mode (field
BIDIR_L and/or BIDIR_H).
–
Select the prescale factor for the counter clock (CTRL register).
–
Clear the HALT_L and/or HALT_H bit. By default, the counters are halted and no
events can occur.
4. To stop the counters by software at any time, stop or halt the counter (write to
STOP_L and/or STOP_H bits or HALT_L and/or HALT_H bits in the CTRL register).
–
When the counters are stopped, both an event configured to clear the STOP bit or
software writing a zero to the STOP bit can start the counter again.
–
When the counter are halted, only a software write to clear the HALT bit can start
the counter again. No events can occur.
–
When the counters are halted, software can set any SCT output HIGH or LOW
directly by writing to the OUT register.