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

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
3.3
© 2009 Microchip Technology Inc.
LESSON 3: ROTATE LED
This lesson builds on the previous two lessons to introduce defining global variables
and code sections, and to add rotation to the LED display. It will light up LED 0, then
shift it to LED 1, then to LED 2 and on up to LED 7, and back to LED 0.
In this and following lessons, please open the lesson workspace in the MPLAB IDE
upon starting the lesson.
3.3.1
In the source code file 03 Rotate LED.c for Lesson 3 the global variable,
LED_Number, is declared as in Figure 3-16.
FIGURE 3-16:
The directive #pragma udata is used prior to declaring the variable LED_Number to
indicate to the compiler that the following declarations are data variables that should be
placed in the PIC18FXXXX file registers. This differs from PC compilers where
instructions and variables share the same memory space due to the Harvard
architecture of the PIC18FXXXX as discussed in Section 2.1 of this document.
There are two directives for use with #pragma when defining variables:
Data declarations can also be given a section name. The section name may be used
with a Linker Script SECTION entry to place it in a particular area of memory. See
Section 2.9 of the “MPLAB C18 C Compiler User’s Guide” (DS51288) for more
information on using sections with Linker Scripts. Even without a Linker Script section,
the #pragma udata directive may be used to specify the starting address of the data
in the file registers. For example, to place LED_Number at the start of file register Bank
3 declare the udata section as:
Other variables declared in a udata or idata section will be placed at subsequent
addresses. For instance, the 16-bit integer
address 0x301 and 0x302
Note that function local variables will be placed on the software stack.
Key Concepts
/**
#pragma udata // declare statically allocated uninitialized variables
unsigned char LED_Number; // 8-bit variable
- The directives #pragma udata and #pragma idata are used to allocate
- The directive #pragma code is used to indicate a section of instructions to
- The directive #pragma romdata is used for constant (read-only) data
- Constant data can be stored in program memory so as not to use up file
udata
idata
#pragma udata mysection = 0x300 unsigned char
LED_Number; // 8-bit variable unsigned int
AnotherVariable;
memory for static variables in the file registers.
be compiled into the program memory of the PIC18FXXXX.
stored in the program memory. This is used with the keyword rom.
register RAM.
V
A
Allocating File Register Memory
R
Uninitialized data. The following data is stored uninitialized in the file register
space.
Initialized data. The following data is stored in the file register space. The initial-
ization values are stored in program memory, and then moved by the start-up
initialization code into file registers before program execution begins.
I
A
PICkit™ 3 Debug Express Lessons
B
LESSON 3 GLOBAL VARIABLE DECLARATION
L
E
.
S
*************************************************/
AnotherVariable above would occupy
DS41370C-page 25

Related parts for PIC18F45K20-I/ML