Products

The things you should know about PIC18F4520 Microcontroller

Hi Friends! Hope you are doing well. Today, I’ll cover the details of the Introduction to PIC18F4520 Microcontroller.

In this post, we’ll discuss each and everything related to PIC18F4520, its pinout and description, main features, block diagram, package and applications. Let’s dive right in and explore everything you need to know.

  1. Description

PIC18F4520 microcontroller is a Microchip PIC microcontroller that is mostly utilized in automation and embedded systems. It is available in three packages: PDIP, QFN, and TQFP, and the first is a 40-pin package (which is the most common), while the other two have a 44-pin interface.

This microcontroller version has a CPU, timers, a 10-bit ADC, and other peripherals for developing connections with external devices. This PIC version, like others in the PIC community, includes everything needed to build an embedded system and automate processes.

Meanwhile, the PIC18F4520 has 32K of program memory, 256 bytes of EEPROM data memory, 1536 bytes of RAM, and 256 bytes of EEPROM data memory. It also has two comparators, a 10-bit A/D converter with 13 channels, and decent memory endurance of roughly 1,000,000 for EEPROM and 100,000 for program memory.

Last but not least, The chip includes an asynchronous serial port that can be connected in either direction, using either the 3-wire Serial Peripheral Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) Bus.

2. Pinout

Pin Number Pin Name Description
18 MCLR/VPP/RE3
MCLR
VPP
RE3
Master Clear (input) or programming voltage (input).
Master Clear (Reset) input. This pin is an active-low
Reset to the device.
Programming voltage input.
Digital input.
30 OSC1/CLKI/RA7
OSC1
CLKI
RA7
Oscillator crystal or external clock input.
Oscillator crystal input or external clock source input.
ST buffer when configured in RC mode;
analog otherwise.
External clock source input. Always associated with
pin function, OSC1. (See related OSC1/CLKI,
OSC2/CLKO pins.)
General purpose I/O pin.
31 OSC2/CLKO/RA6
OSC2
CLKO
RA6
Oscillator crystal or clock output.
Oscillator crystal output. Connects to crystal
or resonator in Crystal Oscillator mode.
In RC mode, OSC2 pin outputs CLKO which
has 1/4 the frequency of OSC1 and denotes
the instruction cycle rate.
General purpose I/O pin.
PORTA is a bidirectional I/O port.
19 RA0/AN0
RA0
AN0
Digital I/O.
Analog input 0.
20 RA1/AN1
RA1
AN1
Digital I/O.
Analog input 1.
21 RA2/AN2/VREF-/CVREF
RA2
AN2
VREF-
CVREF
Digital I/O.
Analog input 2.
A/D reference voltage (low) input.
Comparator reference voltage output.
22 RA3/AN3/VREF+
RA3
AN3
VREF+
Digital I/O.
Analog input 3.
A/D reference voltage (high) input.
23 RA4/T0CKI/C1OUT
RA4
T0CKI
C1OUT
Digital I/O.
Timer0 external clock input.
Comparator 1 output.
24 RA5/AN4/SS/HLVDIN/C2OUT
RA5
AN4
SS
HLVDIN
C2OUT
Digital I/O.
Analog input 4.
SPI slave select input.
High/Low-Voltage Detect input.
Comparator 2 output.
RA6 See the OSC2/CLKO/RA6 pin.
RA7 See the OSC1/CLKI/RA7 pin.
PORTB is a bidirectional I/O port. PORTB can be
software programmed for internal weak pull-ups on all
inputs.
8 RB0/INT0/FLT0/AN12
RB0
INT0
FLT0
AN12
Digital I/O.
External interrupt 0.
PWM Fault input for Enhanced CCP1.
Analog input 12.
9 RB1/INT1/AN10
RB1
INT1
AN10
Digital I/O.
External interrupt 1.
Analog input 10.
10 RB2/INT2/AN8
RB2
INT2
AN8
Digital I/O.
External interrupt 2.
Analog input 8.
11 RB3/AN9/CCP2
RB3
AN9
CCP2(1)
Digital I/O.
Analog input 9.
Capture 2 input/Compare 2 output/PWM2 output.
14 RB4/KBI0/AN11
RB4
KBI0
AN11
Digital I/O.
Interrupt-on-change pin.
Analog input 11.
15 RB5/KBI1/PGM
RB5
KBI1
PGM
Digital I/O.
Interrupt-on-change pin.
Low-Voltage ICSP™ Programming enable pin.
16 RB6/KBI2/PGC
RB6
KBI2
PGC
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming
clock pin.
17 RB7/KBI3/PGD
RB7
KBI3
PGD
Digital I/O.
Interrupt-on-change pin.
In-Circuit Debugger and ICSP programming
data pin.
PORTC is a bidirectional I/O port.
32 RC0/T1OSO/T13CKI
RC0
T1OSO
T13CKI
Digital I/O.
Timer1 oscillator output.
Timer1/Timer3 external clock input.
35 RC1/T1OSI/CCP2
RC1
T1OSI
CCP2(2)
Digital I/O.
Timer1 oscillator input.
Capture 2 input/Compare 2 output/PWM2 output.
36 RC2/CCP1/P1A
RC2
CCP1
P1A
Digital I/O.
Capture 1 input/Compare 1 output/PWM1 output.
Enhanced CCP1 output.
37 RC3/SCK/SCL
RC3
SCK
SCL
Digital I/O.
Synchronous serial clock input/output for
SPI mode.
Synchronous serial clock input/output for I²C™ mode.
42 RC4/SDI/SDA
RC4
SDI
SDA
Digital I/O.
SPI data in.
I²C data I/O.
43 RC5/SDO
RC5
SDO
Digital I/O.
SPI data out.
44 RC6/TX/CK
RC6
TX
CK
Digital I/O.
EUSART asynchronous transmit.
EUSART synchronous clock (see related RX/DT).
1 RC7/RX/DT
RC7
RX
DT
Digital I/O.
EUSART asynchronous receive.
EUSART synchronous data (see related TX/CK).
PORTD is a bidirectional I/O port or a Parallel Slave
Port (PSP) for interfacing to a microprocessor port.
These pins have TTL input buffers when PSP module
is enabled.
38 RD0/PSP0
RD0
PSP0
Digital I/O.
Parallel Slave Port data.
39 RD1/PSP1
RD1
PSP1
Digital I/O.
Parallel Slave Port data.
40 RD2/PSP2
RD2
PSP2
Digital I/O.
Parallel Slave Port data.
41 RD3/PSP3
RD3
PSP3
Digital I/O.
Parallel Slave Port data.
2 RD4/PSP4
RD4
PSP4
Digital I/O.
Parallel Slave Port data.
3 RD5/PSP5/P1B
RD5
PSP5
P1B
Digital I/O.
Parallel Slave Port data.
Enhanced CCP1 output.
4 RD6/PSP6/P1C
RD6
PSP6
P1C
Digital I/O.
Parallel Slave Port data.
Enhanced CCP1 output.
5 RD7/PSP7/P1D
RD7
PSP7
P1D
Digital I/O.
Parallel Slave Port data.
Enhanced CCP1 output.
PORTE is a bidirectional I/O port.
25 RE0/RD/AN5
RE0
RD
AN5
Digital I/O.
Read control for Parallel Slave Port
(see also WR and CS pins).
Analog input 5.
26 RE1/WR/AN6
RE1
WR
AN6
Digital I/O.
Write control for Parallel Slave Port
(see CS and RD pins).
Analog input 6.
27 RE2/CS/AN7
RE2
CS
AN7
Digital I/O.
Chip Select control for Parallel Slave Port
(see related RD and WR).
Analog input 7.
RE3 See MCLR/VPP/RE3 pin.
6, 29 VSS Ground reference for logic and I/O pins.
7, 28 VDD Positive supply for logic and I/O pins.
12, 13, 33, 34 NC No Connect.

3. CAD Model

Symbol

Footprint

3D Model

4. Features

No. of Pins 40
CPU 8-Bit PIC
Operating Voltage 2 to 5.5 V
Program Memory 32K
Program Memory (Instructions) 16384
RAM 1536 Bytes
EEPROM 256 Bytes
ADC

Number of Channels

10-Bit

13

I/O Ports (5)

I/O Pins

A,B,C,D,E

36

Packages
40-pin PDIP
44-pin QFN
44-pin TQFP
External Oscillator up to 40 MHz
Timer (4) 16-Bit Timer (3)

8-Bit Timer (1)

USART Protocol 1
I2C Protocol Yes
SPI Protocol Yes
Brown-out Reset Yes
Watchdog Timer Yes
Comparators 2
Master Synchronous Serial Port (MSSP) module 1
Capture/Compare/PWM 16bit/16bit/10bit
Power Saving Sleep Mode Yes
Selectable Oscillator Option Yes
Operating High-current sink/source

Each pin

25mA
Programmable
High/Low-Voltage Detect
-Yes
Oscillator Start-up Timer Yes

5. Functional Block Diagram  

6. Memory Organization

There are three types of memory in PIC18 enhanced microcontroller devices:

  • Program Memory
  • Data RAM
  • Data EEPROM

The data and program memories employ independent busses as Harvard architecture devices, allowing for simultaneous access to both memory areas. Because it is addressed and accessible by a set of control registers, the data EEPROM can be considered a peripheral device for practical purposes.
Section 6.0 “Flash Program Memory” contains more thorough information on the operation of the Flash program memory. Data EEPROM memory is covered in Section 7.0, “Data EEPROM Memory.”

7. Applications

PIC18F4520 microcontroller is widely used in home and industrial automation. It can be used as student projects for motor controlling and sensor interfacing. GPS and security systems are also allowed. It can be used as gas sensor projects, production of temperature data logger, as well as serial communication, central heating projects, embedded system

In general, the reasons we choose PIC18F4520 microcontroller are listed as follow:

  • PIC microcontrollers are widely used in multiple applications as they come with user-friendly interface and easy onboard architecture that requires little or no prior skills before getting familiar with the chip.
  • They can perform a number of functions using minimum circuitry and are cheap in price as compared to other modules available in the market.
  • Minimum power consumption is another ability that makes this controller an ideal choice for the projects where power limitation is a major concern.
  • PIC controllers stay ahead of other Atmel controller like 8051 in terms of their higher processing speed and efficiency.

That’s all for today. I hope you have found this article useful. If you have any questions, you can approach me in the comment section below, I’d to help you in any way I can. Keep us updated with your valuable feedback and suggestion that help us provide you with quality content as per your needs and requirements. Thanks for reading the article.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button