PIC18F45K22-I/P Microchip Technology Inc., PIC18F45K22-I/P Datasheet - Page 322

no-image

PIC18F45K22-I/P

Manufacturer Part Number
PIC18F45K22-I/P
Description
40 PDIP .600in TUBE, 32KB, Flash, 1536bytes-RAM, 8-bit Family, nanoWatt XLP
Manufacturer
Microchip Technology Inc.
Datasheet

Specifications of PIC18F45K22-I/P

A/d Inputs
28-Channel, 10-Bit
Comparators
2
Cpu Speed
16 MIPS
Eeprom Memory
256 Bytes
Input Output
35
Interface
I2C/SPI/UART/USART
Memory Type
Flash
Number Of Bits
8
Package Type
40-pin PDIP
Programmable Memory
32K Bytes
Ram Size
1.5K Bytes
Speed
64 MHz
Temperature Range
–40 to 125 °C
Timers
3-8-bit, 4-16-bit
Voltage, Range
1.8-5.5 V
Lead Free Status / Rohs Status
RoHS Compliant part Electrostatic Device

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18F45K22-I/P
Manufacturer:
MICROCHIP
Quantity:
3 400
Part Number:
PIC18F45K22-I/P
Manufacturer:
MICROCHIP/微芯
Quantity:
20 000
Part Number:
PIC18F45K22-I/PT
Manufacturer:
SST
Quantity:
3 400
Part Number:
PIC18F45K22-I/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
Part Number:
PIC18F45K22-I/PT
Manufacturer:
MIC
Quantity:
20 000
Part Number:
PIC18F45K22-I/PT
0
Company:
Part Number:
PIC18F45K22-I/PT
Quantity:
20 400
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 PIC18F45K22-I/P