EasyManuals Logo

Microchip Technology PICkit 3 User Manual

Microchip Technology PICkit 3
102 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #79 background imageLoading...
Page #79 background image
Lessons
2012 Microchip Technology Inc. DS41628B-page 79
3.12 LESSON 11: INDIRECT ADDRESSING
3.12.1 Introduction
This lesson covers a very important topic of indirect addressing. The code uses indirect
addressing to implement a moving average filter. This lesson adds a moving average
filter to the Analog-to-Digital code in Lesson 4. The moving average keeps a list of the
last ADC values (n) and averages them together. The filter needs two parts: A circular
queue and a function to calculate the average.
Twisting the potentiometer changes the value read by the Analog-to-Digital converter.
The filtered value is then sent to the LED display.
The filter averages the last eight readings. Choosing a power of two for the number of
samples allows division by simple rotates instead of a general purpose divide routine.
Rather than summing the array every time, it is faster to keep a running sum, then
subtract out the oldest value in the queue and add in the new value.
FIGURE 3-14: MOVING AVERAGE WITH INDIRECT ADDRESSING
3.12.2 Hardware Effects
This lesson provides the same outcome as Lesson 4. The user rotates the POT to see
the LEDs rotate. The top four MSbs of the ADC value are reflected onto the LEDs.
3.12.3 Summary
While the program memory can be addressed in only one way – through the program
counter – information in the data memory space can be addressed in several ways. For
most instructions, the addressing mode is fixed. Other instructions may use up to three
modes, depending on which operands are used and whether or not the extended
instruction set is enabled.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Microchip Technology PICkit 3 and is the answer not in the manual?

Microchip Technology PICkit 3 Specifications

General IconGeneral
BrandMicrochip Technology
ModelPICkit 3
CategoryComputer Accessories
LanguageEnglish

Related product manuals