Summation/Shifter
The
For this summation/shifter peripheral module, there is no possibility of an
Please refer to Section 12.13, Summation/Shifter Register, for more detailed information.
17.8.1 ADC/Summation/Shifter Example
An example program has been provided to give you an insight into how to use the ADC peripheral. In order to show how the
The ADC peripheral is set up with the following features: VREF = 2.5V, Buff is turned on and BOD (Burn Out Detect) is turned off by assigning a value of 0x20 to ADCON0. This register setting also selects an unity gain amplification for the PGA. The bipolar option and the
An ADC Conversion calibration is performed at the beginning of each data conversion session. Calibration is initiated, and the processor enters an idle state and stays there indefinitely, until the calibration process is completed. When the converter calibration is completed, the ACC flag in the AISTAT SFR is set. It is customary to discard the first 20 conversions after calibration.
The initialization of the summation/shifter is straightforward. A value of zero must be written into the SSCON register. This action clears the contents of the ACCR3, ACCR2, ACCR1 and ACCR0 SFRs. Then the proper SSCON value, in this case 0xD2, is assigned. This assignment value sets the accumulate− count, Acc_count, to eight, and the shift count value to eight. The accumulate
&shift option is also selected. This process of clearing and setting the value of SSCON must be done at the beginning of every acc_count data accumula- tion cycle, otherwise the previous accumulate & shift result is combined with the next accumulate & shift data collection.
Keil Simulator | |
|