Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

© 2010 Microchip Technology Inc. DS39724B-page 11-11
Section 11. CTMU
CTMU
11
11.3.2 Current Source
At the heart of the CTMU is a precision current source, designed to provide a constant reference
for measurements. The level of current is user-selectable across three ranges, or a total of two
orders of magnitude, with the ability to trim the output in ±2% increments (nominal). The current
range is selected by the IRNG1:0> bits (CTMUICON<9:8>) with a value of 00 representing the
lowest range.
Current trim is provided by the ITRIM<5:0> bits (CTMUICON<15:10>). These six bits allow trim-
ming of the current source in steps of approximately 2% per step. Note that half of the range
adjusts the current source positively and the other half reduces the current source. A value of
000000 is the neutral position (no change). A value of 100000 is the maximum negative
adjustment (approximately -62%) and 011111 is the maximum positive adjustment
(approximately +62%).
11.3.3 Edge Selection and Control
CTMU measurements are controlled by edge events occurring on the modules two input chan-
nels. Each channel, referred to as Edge 1 and Edge 2, can be configured to receive input pulses
from one of the edge input pins (CTEDG1 and CTEDG2), Timer1 or Output Compare Module 1.
The input channels are level-sensitive, responding to the instantaneous level on the channel
rather than a transition between levels. The inputs are selected using the EDG1SEL and
EDG2SEL bit pairs (CTMUCON<3:2> and <6:5> or CTMUCON2<5:2> and <13:9>).
In addition to source, each channel can be configured for event polarity using the EDGE2POL
and EDGE1POL bits (CTMUCON<7:4> or CTMUCON2<14:6>). The input channels can also be
filtered for an edge event sequence (Edge 1 occurring before Edge 2) by setting the EDGSEQEN
bit (CTMUCON<10> or CTMUCON1<10>).
11.3.4 Edge Status
The CTMUCON register also contains two status bits: EDG2STAT and EDG1STAT
(CTMUCON<1:0> or CTMUCON2<9:8>). Their primary function is to show if an edge response
has occurred on the corresponding channel. The CTMU automatically sets a particular bit when
an edge response is detected on its channel. The level-sensitive nature of the input channels
also means that the status bits become set immediately if the channels configuration is changed
and is the same as the channels current state.
The module uses the edge status bits to control the current source output to external analog mod-
ules (such as the A/D Converter). Current is only supplied to external modules when only one
(but not both) of the status bits is set and shuts current off when both bits are either set or cleared.
This allows the CTMU to measure current only during the interval between edges. After both
status bits are set, it is necessary to clear them before another measurement is taken. Both bits
should be cleared simultaneously, if possible, to avoid re-enabling the CTMU current source.
In addition to being set by the CTMU hardware, the edge status bits can also be set by software.
This is also the users application to manually enable or disable the current source. Setting either
one (but not both) of the bits enables the current source. Setting or clearing both bits at once
disables the source.
11.3.5 Interrupts
The CTMU sets its interrupt flag (IFS4<13>) whenever the current source is enabled, then dis-
abled. An interrupt is generated only if the corresponding interrupt enable bit (IEC4<13>) is also
set. If edge sequencing is not enabled (i.e., Edge 1 must occur before Edge 2), it is necessary to
monitor the edge status bits and determine which edge occurred last and caused the interrupt.

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh