dsPIC30F Demonstration Program Operation
©
2006 Microchip Technology Inc.
DS70099D-page 37
3.4.2
Main Loop Code Execution
The step-by-step Main Loop execution sequence is shown in Table 3-4.
TABLE 3-4:
MAIN LOOP CODE EXECUTION SEQUENCE
Seq
Program Task
1
12-bit ADC collects 256 samples from the digital potentiometer output on AN3 into
a RAM buffer. It also collects one sample each from AN4 (RP2), AN5 (RP3), AN6
(RP1) and AN8 (Temperature Sensor U9). All A/D conversions are performed in
an interrupt-driven configuration.
2
Buffered data set is filtered using an IIR filter to remove line noise. The filter can
be changed to an FIR filter or no filter from the DSP menu options. The filtering
operation is benchmarked using the Timer4/5 pair.
3
A complex in-place 256-point FFT is performed on the filtered data set, resulting
in complex frequency data (x + jy). This operation is benchmarked using the
Timer4/5 pair.
4
Squared magnitude is computed for each frequency bin in an in-place fashion
(x
2
+ y
2
).
5
The magnitude data is run through a routine that returns the frequency bin and
magnitude of the largest element.
6
The magnitude of the largest element is compared against a threshold and
captured if it is greater than the threshold so that low-level noise does not show
up as a frequency estimate. (Provides a simplified peak-detection algorithm.)
7
If a Timer3 count has expired, a software flag is set to inform the CPU that the
results recorded may now be displayed. This ensures that the CPU refreshes the
display buffers.
8
Any user choices entered via the switches SW1-SW4 are checked and the new
user selections are applied. May involve a change of display screen or some
parameter displayed on the LCD.
9
The changes are communicated to the PIC18F242 LCD controller via the SPI 2
module.
10
In the special case of the DTMF menu, the main routine may also kick off the DCI
module operation when the user requests DTMF tone generation.
Содержание dsPICDEM 1.1 Plus
Страница 1: ...2006 Microchip Technology Inc DS70099D dsPICDEM 1 1 Plus Development Board User s Guide...
Страница 12: ...dsPICDEM 1 1 Plus Development Board User s Guide DS70099D page 8 2006 Microchip Technology Inc NOTES...
Страница 64: ...dsPICDEM 1 1 Plus Development Board User s Guide DS70099D page 60 2006 Microchip Technology Inc NOTES...
Страница 78: ...dsPICDEM 1 1 Plus Development Board User s Guide DS70099D page 74 2006 Microchip Technology Inc NOTES...
Страница 88: ...dsPICDEM 1 1 Plus Development Board User s Guide DS70099D page 84 2006 Microchip Technology Inc NOTES...
Страница 91: ...Index 2006 Microchip Technology Inc DS70099D page 87 NOTES...