PIC18F45K20-E/P Microchip Technology, PIC18F45K20-E/P Datasheet - Page 27

32KB, Flash, 1536bytes-RAM, 36I/O, 8-bit Family,nanowatt XLP 40 PDIP .600in TUBE

PIC18F45K20-E/P

Manufacturer Part Number
PIC18F45K20-E/P
Description
32KB, Flash, 1536bytes-RAM, 36I/O, 8-bit Family,nanowatt XLP 40 PDIP .600in TUBE
Manufacturer
Microchip Technology
Series
PIC® XLP™ 18Fr

Specifications of PIC18F45K20-E/P

Core Processor
PIC
Core Size
8-Bit
Speed
48MHz
Connectivity
I²C, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, HLVD, POR, PWM, WDT
Number Of I /o
35
Program Memory Size
32KB (16K x 16)
Program Memory Type
FLASH
Eeprom Size
256 x 8
Ram Size
1.5K x 8
Voltage - Supply (vcc/vdd)
1.8 V ~ 3.6 V
Data Converters
A/D 14x10b
Oscillator Type
Internal
Operating Temperature
-40°C ~ 125°C
Package / Case
40-DIP (0.600", 15.24mm)
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With
DM240313 - BOARD DEMO 8BIT XLPAC164112 - VOLTAGE LIMITER MPLAB ICD2 VPPDM164124 - KIT STARTER FOR PIC18F4XK20
Lead Free Status / RoHS Status
Lead free / RoHS Compliant

Available stocks

Company
Part Number
Manufacturer
Quantity
Price
Part Number:
PIC18F45K20-E/PT
Manufacturer:
Microchip Technology
Quantity:
10 000
FIGURE 3-15:
© 2009 Microchip Technology Inc.
/**
#include "p18f45k20.h"
#include "delays.h"
/**
void
{
}
I
D
main
TRISD
while
{
}
N
E
C
C
(void)
L
L
=
(1)
LATDbits.LATD7
Delay1KTCYx(50);//
U
A
0b01111111;//
The Configuration bit settings that are important for this lesson project and are different
from the default values are:
Even though all other bit settings are left as default, it is strongly recommended to
define them all in the source as is done in the Lesson 2 source code. This ensures that
the program memory image in the .hex file built by the compiler contains all the
configuration settings intended for the target application. The one exception is the
DEBUG bit, as this is defined by the MPLAB IDE environment depending on whether
the target microcontroller is running in Debug mode or not.
3.2.3
Open the Lesson 2 source code file 02 Blink LED.c in an MPLAB IDE editor window
if it is not open already.
LESSON 2 “BLINK LED” SOURCE CODE
This source code contains a couple of new lines of interest. The first is a new include
file:
This is the header file for the MCC18 “delays” library, which provides functions used to
create program delays of a certain number of processor cycles. The MPLAB C compiler
comes with a number of useful libraries. These include the standard C libraries stdio
and stdlib, and function libraries such as ctype, delays, math, and string.
There are also libraries for using hardware peripheral functions such as adc, i2c, pwm,
spi, usart, and timers as well as for software emulation of peripherals like sw_i2c,
sw_uart, and sw_spi.
FOSC = INTIO67
WDTEN = OFF
LVP = OFF
D
R
E
A
#include
S
T
**************************************************/
I
Exploring the Lesson 2 Source Code
=
O
PORTD
~LATDbits.LATD7;
N
Delay
PICkit™ 3 Debug Express Lessons
S
bit
"delays.h"
*******************************************/
50
7
This sets the PIC18F45K20 to run using the internal oscillator, so
no crystal or external oscillator is needed. The default frequency is
1 MHz. The oscillator is covered in more detail in Lesson 9. It also
sets OSC1 and OSC2 pins to be used as the RA6 and RA7 I/O
port pins as the OSC pin functions are not needed.
This turns off the Watchdog Timer, as it is not used in this lesson.
When the Watchdog Timer is enabled, it must be cleared periodi-
cally in the code or it will reset the microcontroller.
This turns off Low-Voltage-Programming, and frees the PGM pin to
be used as the RB5 I/O port pin. (LVP mode is not used by the
PICkit 3 programmer.)
x
to
1000
output
//
=
toggle
50,000
(0)
;
LATD
cycles;
bits
6:0
200ms
are
@
inputs
1MHz
(1)
DS41370C-page 23

Related parts for PIC18F45K20-E/P