Peripheral Interface Controller
Peripheral Interface Controller
TO
PIC
MICROCONTROLLERS
The term PIC stands for
“Peripheral Interface Controller”
Interrupt control:
Up to 12 independent interrupt sources can
control when the CPU will deal with each sources.
Timer1:
Timer1 16-bit timer/counter with prescaler
can be incremented during sleep via
external crystal/clock
Timer2:
Timer2 8-bit timer/counter with 8-bit
period register, pre- scaler and post-
scaler
R.Hariharan AP / EEE -SECE
Capture/Compare/PWM (CCP) module(s)
Capture is 16-bit, max resolution is 12.5 ns,
Compare is 16-bit, max resolution is 200ns, PWM
max resolution is 10-bit
Synchronous Serial Port (SSP) with SPI TM and I2C
Universal Synchronous Asynchronous Receiver
Transmitter (USART/SCI)
Parallel Slave Port (PSP) 8-bits wide, with
external RD, WR and CS controls
Brown-out detection circuitry for Brown-out
Reset (BOR)
PIC16CXX microcontroller family has
enhanced core features, eight-level deep
stack, and multiple internal and external
R.Hariharan AP / EEE -SECE
interrupt sources.
R.Hariharan AP / EEE -SECE
To Which DOT you are attracted more
after the stack has been pushed eight times, the ninth push
overwrites the value that was stored with the first push.
The PIC16CXX can directly or indirectly address its
register files or data memory.
The PIC16CXX has an orthogonal instruction set
that makes it possible to carry out any operation on
any register using any addressing mode.
R.Hariharan AP / EEE -SECE
CPU REGISTERS
The CPU registers are
Working Register (W)
Status – Register
FSR – File Select Register
INDF
PCLATH
Program Counter
PCL
Eight Level Stack
8
All SFR in PIC are ______ bits size
R.Hariharan AP / EEE -SECE
Working Register:(W)
Temporary holding register.
Called as Accumulator.
Cannot be access Directly
W content moved to some other register
and then it can be accessed.
used by many instructions as source of
an operand.
destination for the result of
instruction execution.
It is a 8-bit regarding.
inc f
FSR =
FSR = INDF
INDF =
=
05
06
R.Hariharan AP / EEE -SECE 10
0A
Program Counter: (PC) 13 bit wide
PCL 8 Bit – Readable
PCH 5 Bit – Not Readable
Cleared
But are indirectly writable
through the PCLATH register.
Cleare PCLATH is SFR 8 Bits but
d only upper 5bits are used.
Memor Mnemonic PC
y L
Locatio
n 0
0 ORG 0 1
2
1 clrf PORT A
2 clrf PORT B 3
3 clrf TRISA 4
4 Loop 1: clrf 5
PORTC 64
5 clrf TRISB
6R.Hariharangoto Loop1
AP / EEE -SECE
PCL – Program Counter
ProgramLow
Counter = 0
PCLATH – Program Counter Latch Holding
Power ON / Reset 8
Program Counter Low is a SFR with __ bits
Memor Mnemonic PC PCL – Point the next
y L
command to be executed
Locatio
n 0
Program memory – 8K.
ORG 0 1
So 2^13 = 8192
0 movwf PORTB 2
1 clrf PORT A 3 But PCL is 8 Bits, we can
2 clrf PORT B 4 only move up to
5 2^8 = 256 different
3 clrf TRISA
locations
4 Loop 1: clrf 6
PORTC 74
5R.Hariharanclrf TRISB
AP / EEE -SECE
6 goto Loop1
PCLATH – Program Counter Latch Holding
Memor
y
Mnemonic PC
L
PCLH – Holding register
Locatio Data memory – 8K
n 0
PC= 11, allowing to jump 2K
ORG 0 1
So 2 ^ 11 = 2024
0 clrf PORT A 2
Stac
1 Call Out 3
k
3
2 clrf TRISA 4 8
3 Loop 1: clrf 5 .
PORTC .
6
4 clrf TRISB .
5 goto Loop1
2
.
100 2
6 1 9
100 Out:
R.Hariharan AP / clrf PORT 10
EEE -SECE
0 4
B
PCL – (Program Counter Low Byte): Special Purpose
Register
Indirect addressing.
the lower 8-bits of the 13-bit program counter.
We can read the register values.
Program memory :
13 Bit program counter
• PIC16C7X family has a _________
PC = 0004h
Reset
Interrupt
Power
ON
R.Hariharan AP / EEE -SECE
Page PC LATCH Start End
Numbe Bit 4 Bit 3 Positio Positio
r n n
0 0 0 0000 7FFh
h
1
R.Hariharan AP / EEE -SECE 0 1 800 FFFh
Program Memory
A program memory of 6x/7x family
controllers have either 2k,4k or 8k address
of program memory.
PIC family uses 13-bit program counter
allowing the controllers to an 8k-program
memory without changing the CPU
structure.
2 ^ 9 = 512 Bytes
96 + 80 + 16 + 80 + 16 + 80
= 368 Bytes
0 1 0 0 0 0 0 0 0 80
Bank 1
0 1 1 1 1 1 1 1 1 FF
= 7 Bits
Bank
0
0 00h - FFh
Bank
1
Bank
R.Hariharan100h
AP / EEE
– -SECE
2
1 1FFh
R.Hariharan AP / EEE -SECE
Pipelining
• Bit-oriented instruction
Ex :
btfsc PORT A, 4