TO PIC Microcontrollers
TO PIC Microcontrollers
TO PIC Microcontrollers
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.
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.
FSR
inc f=
INDF
INDF ==
FSR05= 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.
PCLATH is SFR 8 Bits but
Cleared only upper 5bits are used.
Memory Mnemonic PC
Location L
0 ORG 0 0
1 clrf PORT A 1
2 clrf PORT B 2
3 clrf TRISA 3
4 Loop 1: clrf 4
PORTC
5
5 clrf TRISB
64
6 goto Loop1
101R.Hariharan AP return
/ EEE -SECE 0 4
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
0 0 0 0000h 7FFh
1 0 1 800 FFFh
2 1 0 10000 17FFh
R.Hariharan AP / EEE -SECE
3 1 1 1800 1FFFh
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.Hariharan AP / EEE -SECE
2 100h – 1FFh
1
R.Hariharan AP / EEE -SECE
Pipelining
• Bit-oriented instruction
Ex :
btfsc PORT A, 4