PIC18LF47J53-I/ML Microchip Technology, PIC18LF47J53-I/ML Datasheet - Page 322

IC PIC MCU 128KB FLASH 44QFN

PIC18LF47J53-I/ML

Manufacturer Part Number
PIC18LF47J53-I/ML
Description
IC PIC MCU 128KB FLASH 44QFN
Manufacturer
Microchip Technology
Series
PIC® XLP™ 18Fr

Specifications of PIC18LF47J53-I/ML

Core Size
8-Bit
Program Memory Size
128KB (64K x 16)
Core Processor
PIC
Speed
48MHz
Connectivity
I²C, LIN, SPI, UART/USART, USB
Peripherals
Brown-out Detect/Reset, POR, PWM, WDT
Number Of I /o
34
Program Memory Type
FLASH
Ram Size
3.8K x 8
Voltage - Supply (vcc/vdd)
2 V ~ 2.75 V
Data Converters
A/D 13x10b/12b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
*
Controller Family/series
PIC18
Cpu Speed
48MHz
Digital Ic Case Style
QFN
Supply Voltage Range
1.8V To 3.6V
Embedded Interface Type
I2C, SPI, USART
Rohs Compliant
Yes
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Eeprom Size
-
Lead Free Status / RoHS Status
Lead free / RoHS Compliant, Lead free / RoHS Compliant
PIC18(L)F2X/4XK22
EXAMPLE 19-2:
DS41412D-page 322
#include "p18cxxx.h"
#define COUNT 500
#define DELAY for(i=0;i<COUNT;i++)
#define RCAL .027
#define ADSCALE 1023
#define ADREF 3.3
int main(void)
{
//assume CTMU and A/D have been set up correctly
//see Example 25-1 for CTMU & A/D setup
setup();
CTMUCONHbits.CTMUEN = 1;
CTMUCONLbits.EDG1STAT = 0;
CTMUCONLbits.EDG2STAT = 0;
}
int i;
int j = 0;
unsigned int Vread = 0;
double VTot = 0;
float Vavg=0, Vcal=0, CTMUISrc = 0;
for(j=0;j<10;j++)
{
}
Vavg = (float)(VTot/10.000);
Vcal = (float)(Vavg/ADSCALE*ADREF);
CTMUISrc = Vcal/RCAL;
CTMUCONHbits.IDISSEN = 1;
DELAY;
CTMUCONHbits.IDISSEN = 0;
CTMUCONLbits.EDG1STAT = 1;
DELAY;
CTMUCONLbits.EDG1STAT = 0;
PIR1bits.ADIF = 0;
ADCON0bits.GO=1;
while(!PIR1bits.ADIF);
Vread = ADRES;
PIR1bits.ADIF = 0;
VTot += Vread;
CURRENT CALIBRATION ROUTINE
Preliminary
//@ 8MHz = 125uS.
//R value is 4200000 (4.2M)
//scaled so that result is in
//1/100th of uA
//for unsigned conversion 10 sig bits
//Vdd connected to A/D Vr+
//index for loop
//float values stored for calcs
//Enable the CTMU
// Set Edge status bits to zero
//drain charge on the circuit
//wait 125us
//end drain of circuit
//Begin charging the circuit
//using CTMU current source
//wait for 125us
//Stop charging circuit
//make sure A/D Int not set
//and begin A/D conv.
//Wait for A/D convert complete
//Get the value from the A/D
//Clear A/D Interrupt Flag
//Add the reading to the total
//Average of 10 readings
//CTMUISrc is in 1/100ths of uA
 2010 Microchip Technology Inc.

Related parts for PIC18LF47J53-I/ML