Sensor Board Metal Detection using PIC16F18446
Check out this project's MPLAB Xpress Webpage to view the complete code example along with a detailed step by step write-up and description, or visit the PIC16F18446 Device Product Page for more information.
About this Code Example
The PIC16F184xx family has a new Analog to Digital Converter with Computation (ADCC) with a 12-bit resolution. This project shows the reading of a metal detector using the ADCC.
In this example we will be using the PIC16F18446 Sensor Board. Initially, the board scans the metal detector LC circuit in order to find the peak (resonant) frequency. It then supplies a signal with that frequency using the NCO, and reads the ADCC. If a metal object approaches, it shifts the resonant frequency, and the ADCC value changes. The demo has 2 operating modes. In the first mode, the 12-bit and 10-bit values are plotted in real time.
When entering this mode, the first ADCC reading is used as an offset for the plots. The LCD backlight turns OFF after some time of inactivity, and turns back ON when the user presses a button. In the second mode, the buzzer is beeping at a variable time interval, according to the metal detector reading.
Here are the settings used for MSSP, CLC, NCO, FVR, ADCC, CCP, CWG, and TMR. MSSP + CLC are used for the LCD control.
The NCO is used to oscillate the LC circuit.
FVR is used as positive refference for the ADCC, to get higher accuracy and gain.
ADRPT register is set to 0x40, to average a burst of 64 samples.
CCP1 is used for generating the buzzer tone.
CWG is used to output the signal from CCP1 in antiphase on 2 pins, so that the buzzer sounds louder.
TMR1 is used to clock the CCP1. It sets the pitch of the buzzer tone.TMR3 is used to set the beep interval.
- Dec 4, 2018