PIC18F45K20-I/ML Microchip Technology, PIC18F45K20-I/ML Datasheet - Page 32

IC PIC MCU FLASH 16KX16 44QFN

PIC18F45K20-I/ML

Manufacturer Part Number
PIC18F45K20-I/ML
Description
IC PIC MCU FLASH 16KX16 44QFN
Manufacturer
Microchip Technology
Series
PIC® XLP™ 18Fr

Specifications of PIC18F45K20-I/ML

Program Memory Type
FLASH
Program Memory Size
32KB (16K x 16)
Package / Case
44-QFN
Core Processor
PIC
Core Size
8-Bit
Speed
64MHz
Connectivity
I²C, SPI, UART/USART
Peripherals
Brown-out Detect/Reset, HLVD, POR, PWM, WDT
Number Of I /o
35
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 ~ 85°C
Processor Series
PIC18F
Core
PIC
Data Bus Width
8 bit
Data Ram Size
1.5 KB
Interface Type
CCP/ECCP/EUSART/I2C/MSSP/SPI
Maximum Clock Frequency
64 MHz
Number Of Programmable I/os
36
Number Of Timers
4
Maximum Operating Temperature
+ 85 C
Mounting Style
SMD/SMT
3rd Party Development Tools
52715-96, 52716-328, 52717-734, 52712-325, EWPIC18
Development Tools By Supplier
PG164130, DV164035, DV244005, DV164005, PG164120, DV164136
Minimum Operating Temperature
- 40 C
On-chip Adc
14-ch x 10-bit
Package
44QFN EP
Device Core
PIC
Family Name
PIC18
Maximum Speed
64 MHz
Operating Supply Voltage
2.5|3.3 V
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 PIC18F4XK20AC164322 - MODULE SOCKET MPLAB PM3 28/44QFN
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
PICkit™ 3 Debug Express
FIGURE 3-19:
DS41370C-page 28
/**
#pragma udata // declare statically allocated uninitialized variables
unsigned char LED_Number; // 8-bit variable
/**
// declare constant data in program memory starting at address 0x180
#pragma romdata Lesson3_Table = 0x180
const rom unsigned char LED_LookupTable[8] = {0x01, 0x02, 0x04, 0x08,
#pragma
void
{
}
LED_Number
TRISD
while
{
}
V
D
main
LATD = LED_LookupTable[LED_Number];
LED_Number++;//
if
LED_Number
Delay1KTCYx(50);//
A
E
code//
=
(1)
R
C
(LED_Number
(void)
// use lookup table to output one LED on based on LED_Number value
0b00000000;//
I
L
=
A
A
declare
0;//
=
LESSON 3 “ROTATE LED” SOURCE CODE
Here is the basic flow of our Rotate LED program:
3.3.4
In the MPLAB IDE, build the Lesson 3 project and program the code into the demo
board using the PICkit 3 Programmer.
The demo board LEDs will rotate from LED 0 up to LED 7 and then back to LED 0.
B
R
Initialize Variables and I/O Port
Loop Forever with the while(1) statement:
0;//
L
A
initialize
rotate
==
E
T
executable
Delay
(Loop End)
PORTD
8)
go
S
I
Build and Program the Lesson 3 Code
*************************************************/
O
display
back
The global variable LED_Number, which holds the number of the LED we cur-
rently want on, is set to ‘0’ for the first LED.
The TRISD register bits are all set to ‘0’, so that all 8 port D pins RD0-RD7 are
outputs.
Set the I/O Port to turn on an LED.
Rotate the LED number
Delay
200ms
50
bits
N
S
instructions
to
x
*******************************************/
7:0
by
1000
LED
The number of the LED to turn on, LED_Number, is used an index
to the array LED_LookupTable which returns a value with a bit set
corresponding to the LED to be turned on. This value is written to
the LATD register to turn on the one LED.
The LED number is incremented to the next LED. The if state-
ment checks to see if it has been incremented past the last LED. If
so, it is reset to the first LED, number 0.
As in Lesson 2, a “delays” library function is used to create a time
delay.
1
are
0.
=
0x10, 0x20, 0x40, 0x80};
50,000
all
outputs
cycles;
(0)
200ms
@
1MHz
© 2009 Microchip Technology Inc.

Related parts for PIC18F45K20-I/ML