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

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
FIGURE 3-22:
© 2009 Microchip Technology Inc.
/**
#pragma udata // declare statically allocated uinitialized variables
unsigned char LED_Display; // 8-bit variable
/**
#pragma
void
{
V
D
main
A
E
unsigned
LED_Display
TRISD
INTCON2bits.RBPU
WPUBbits.WPUB0
ANSELH
TRISBbits.TRISB0
while
{
code//
if (LED_Display == 0)
R
C
LATD
LED_Display
while
Switch_Count = 5;
do
{ // monitor switch input for 5 lows in a row to debounce if
(void)
while (Switch_Count < DetectsInARow);
I
L
=
(1)
LED_Display
=
(Switch_Pin == 0)
{ // pressed state detected
}
else
{
}
Delay10TCYx(25); // delay 250 cycles or 1ms. }
A
A
declare
=
char
0b00000000;
(Switch_Pin
0x00;
Switch_Count
B
R
LED_Display;
LESSON 4 “SWITCH INPUT” SOURCE CODE
3.4.3.1
This program has 2 declared variables, the global variable LED_Display and the local
variable Switch_Count. A global variable will be placed in a dedicated location in the
file register space as discussed in Lesson 3. A local variable is placed on the software
stack, and is created when a function is entered, and destroyed (removed from the
stack) when the function exits.
3.4.3.2
The demo board switch is connected to I/O pin RB0, which is normally pulled up to V
internally. When the switch is pressed, it pulls RB0 to ground (low state).
The PORTx Special Function Registers are used to read the state of an input pin.
Therefore, reading PORTBbits.RB0 will give the value of the signal on the RB0 pin.
Don’t forget – in the header file, this was defined as Switch_Pin, which is what the
code uses to read the pin value:
#define
=
Switch_Count++;
L
A
Switch_Count
1;
=
<<=
E
T
executable
=
=
1;
=
S
I
0;
1;
1;
1;
!=
*************************************************/
O
VARIABLES
SWITCH INPUT
Switch_Pin
=
N
1);//
0;
S
instructions
=
PICkit™ 3 Debug Express Lessons
//
//
//
//
//
//
//
//
//
*******************************************/
0;
wait
initialize
PORTD
enable
enable
AN8-12
PORTB
output
rotate
rotated
PORTBbits.RB0
for
bits
bit
PORTB
pull
are
LED_Display
display
bit
switch
0
7:0
digital
up
out,
internal
(connected
by
to
are
on
so
value
1
be
RB0
inputs
all
set
pullups
released
to
outputs
to
bit
(AN12
switch)
PORTD
0
(0)
on
LEDs
is
RB0)
input
DS41370C-page 31
(1)
DD

Related parts for PIC18F45K20-I/ML