NEC V850ES/F 3-L Series User Manual page 367

32-bit single-chip microcontroller
Table of Contents

Advertisement

16-Bit Timer/Event Counter AA
Figure 10-37
Flow of 32-bit Read (Capture or Counter Value)
Disabling the capture interrupt (INTTAAmCCR0/1) is not required if the read
sequence is done in the interrupt service routine, as nesting of the same
interrupt is not possible. However, if the read operation is done in a normal
routine while the interrupt signal is also assigned to a interrupt service routine,
disabling the interrupt is mandatory, otherwise corrupted data might be read.
The same flow can be used for reading the timer counter value. In this case the
relevant interrupt which pending flags needs to be cleared and checked is
INTTAAmOV. Please note that you can either read the upper 16-bit counter
(TAAnCNT) and then the lower 16-bit counter (TAAmCNT) or vice versa. While
both methods work, the read values can be slightly different, as the count
operation of the lower 16-bit counter continues while the upper 16-bit timer is
read:
• When reading the upper 16-bit first, the lower 16-bit might be incremented
during that read.
• When reading the lower 16-bit first, the value might be already "old" after
reading the upper 16-bit.
The software programmer needs to decide which method is considered better
for the application.
User's Manual U18743EE1V2UM00
START
Disable INTTAAmCCR0/1
Clear INTTAAmCCR0/1
pending flag
Read TMAAnCCR0/1
and store as upper 16-bit
capture value
Read TMAAmCCR0/1
and store as lower 16-bit
capture value.
INTTAAmCCR0/1
pending?
No
Enable INTTAAmCCR0/1
END
Chapter 10
Yes
367

Advertisement

Table of Contents
loading

Table of Contents