PIC18F27J53T-I/SO Microchip Technology, PIC18F27J53T-I/SO Datasheet - Page 430

no-image

PIC18F27J53T-I/SO

Manufacturer Part Number
PIC18F27J53T-I/SO
Description
28-pin, USB, 128KB Flash, 4KB RAM, 12 MIPS, 12-bit ADC, NanoWatt XLP 28 SOIC .30
Manufacturer
Microchip Technology
Series
PIC® XLP™ 18Fr
Datasheets

Specifications of PIC18F27J53T-I/SO

Core Processor
PIC
Core Size
8-Bit
Speed
48MHz
Connectivity
I²C, LIN, SPI, UART/USART, USB
Peripherals
Brown-out Detect/Reset, POR, PWM, WDT
Number Of I /o
22
Program Memory Size
128KB (64K x 16)
Program Memory Type
FLASH
Ram Size
3.8K x 8
Voltage - Supply (vcc/vdd)
2.15 V ~ 3.6 V
Data Converters
A/D 10x10b/12b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 85°C
Package / Case
*
Processor Series
PIC18F
Core
PIC
Data Bus Width
8 bit
Data Ram Size
3.8 KB
Interface Type
I2C, SPI, USART
Maximum Clock Frequency
48 MHz
Number Of Programmable I/os
16
Number Of Timers
8
Operating Supply Voltage
2.15 V to 3.6 V
Maximum Operating Temperature
+ 85 C
Mounting Style
SMD/SMT
Minimum Operating Temperature
- 40 C
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Eeprom Size
-
Lead Free Status / Rohs Status
 Details
PIC18F47J53 FAMILY
EXAMPLE 27-2:
DS39964B-page 430
#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)
{
}
setup();
int i;
int j = 0; //index for loop
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.CTMUEN = 1;
CTMUCONLbits.EDG1STAT = 0;
CTMUCONLbits.EDG2STAT = 0;
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
//drain charge on the circuit
//@ 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+
//float values stored for calcs
//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
//Enable the CTMU
// Set Edge status bits to zero
//assume CTMU and A/D have been setup correctly
//see Example 25-1 for CTMU & A/D setup
 2010 Microchip Technology Inc.

Related parts for PIC18F27J53T-I/SO