|
1 |
| -<div id="readme" class="Box-body readme blob js-code-block-container"> |
2 |
| - <article class="markdown-body entry-content p-3 p-md-6" itemprop="text"><p><a href="https://www.microchip.com" rel="nofollow"><img src="https://camo.githubusercontent.com/5fb5505f69a28ff407841612dfe2b7004f210594/68747470733a2f2f636c6475702e636f6d2f553071684c7742696a462e706e67" alt="MCHP" data-canonical-src="https://cldup.com/U0qhLwBijF.png" style="max-width:100%;"></a></p> |
| 1 | +[](https://www.microchip.com) |
3 | 2 |
|
4 | 3 |
|
5 |
| -# Introduction |
| 4 | +# PIC16F18446 Sensor Board Battery Measurement |
| 5 | + |
6 | 6 | The PIC16F184xx family has a new Analog to Digital Converter with Computation (ADCC) with a 12-bit resolution. This project shows how the PIC can internally measure its Vdd using the ADCC and FVR.
|
7 | 7 |
|
8 |
| -# Description |
9 | 8 | In this example we will be using the PIC16F18446 Sensor Board. Battery (Vdd) level measurement is performed while the display is turned on. The percentage level of the remaining charge in the batteries is shown as a battery icon with proportional filing in the top-right corner of the display. Additionally, the battery voltage in Volts and percentage graph are displayed.
|
10 | 9 |
|
11 |
| - |
| 10 | +## Related Documentation |
| 11 | +- [PIC16F18446 Product Family Page](https://www.microchip.com/design-centers/8-bit/pic-mcus/device-selection/pic16f18446) |
| 12 | +- [PIC16F18446 datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/40001985B.pdf) for more information or specifications. |
| 13 | + |
| 14 | + |
| 15 | +## Software Used |
| 16 | +- MPLAB® X IDE 5.30 or newer [(microchip.com/mplab/mplab-x-ide)](http://www.microchip.com/mplab/mplab-x-ide) |
| 17 | +- MPLAB® XC8 2.10 or a newer compiler [(microchip.com/mplab/compilers)](http://www.microchip.com/mplab/compilers) |
| 18 | +- MPLAB® Code Configurator (MCC) 3.95.0 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator) |
| 19 | +- MPLAB® Code Configurator (MCC) Device Libraries 8-bit AVR MCUs 2.3.0 or newer [(microchip.com/mplab/mplab-code-configurator)](https://www.microchip.com/mplab/mplab-code-configurator) |
| 20 | +- PIC16F1xxxx DFP 1.2.99 or newer Device Pack |
| 21 | + |
| 22 | +## Hardware Used |
| 23 | +- [PIC16F18446 Sensor Board Demonstration](https://www.microchip.com/promo/pic16f18446-sensor-board-demonstration) |
| 24 | + |
| 25 | + |
| 26 | +## Setup |
12 | 27 |
|
13 | 28 | To get the Vdd voltage, ADCC is used to measure the FVR (which is configured to 1.024V) with Vdd as positive reference. Then the Vdd is calculated using this formula: Vdd = 1.024V * 4096 / ADC_Reading.
|
14 | 29 |
|
15 |
| -# MCC Settings |
| 30 | +### MCC Settings |
16 | 31 |
|
17 | 32 | Here are the settings used for MSSP, CLC, FVR, and ADCC. MSSP + CLC are used for the LCD control.
|
18 | 33 | ### MSSP Settings
|
19 |
| - |
| 34 | +<br><img src="images/MSSP1.png" width="600"> |
20 | 35 |
|
21 | 36 | ### CCL Settings
|
22 |
| - |
| 37 | +<br><img src="images/CLC1.png" width="600"> |
23 | 38 |
|
24 |
| - |
| 39 | +<br><img src="images/CLC2.png" width="600"> |
25 | 40 |
|
26 | 41 | ### FVR Settings
|
27 |
| - |
| 42 | +<br><img src="images/FVR.png" width="600"> |
28 | 43 |
|
29 | 44 | ### ADCC settings
|
30 |
| - |
| 45 | +<br><img src="images/ADCC1.png" width="600"> |
31 | 46 | ADRPT register is set to 0x40, to average a burst of 64 samples.
|
32 |
| - |
| 47 | +<br><img src="images/ADCC2.png" width="600"> |
33 | 48 |
|
34 | 49 | ### PIN Grid
|
35 |
| - |
| 50 | +<br><img src="images/PIN_Grid.png" width="600"> |
36 | 51 |
|
37 | 52 | ### PIN Module
|
38 |
| - |
| 53 | +<br><img src="images/PIN_Module.png" width="600"> |
| 54 | + |
| 55 | +## Demo |
| 56 | +<br><img src="images/display.png" width="600"> |
0 commit comments