Sunteți pe pagina 1din 25

Introduction to PIC 16C74X

Microcontroller
By,
ArulselvamK
Introduction
PIC Peripheral Interface Controller given by
Microchip Technology.
It is designed with Harvard architecture.
Harvard architecture is designed with
separate busses for handling data and
address. Hence execution time for instruction
is less as compared to Van Neumann
architecture.
A
r
c
h
i
t
e
c
t
u
r
e

o
f

1
6
C
7
4
Features of PIC 16C74
8 Bit microcontroller having 40 pins.
It has 33 I/O pins for connecting peripheral devices. (5
ports)
Port A(6 bits)-A/D Converter
Port B(8 bits) External Interrupts
Port C(8 bits)- Serial Port/ Timer I/O
Port D(8 bits)- Parallel Slave port
Port D(3 bits) A/D converter
Each I/O pin is capable of handling current of 25 mA.
It has inbuilt three programmable timers.
Timer 0 8Bits, Timer 1-16 bits, Timer 2-8 bits
Inbuilt 8 bits A/D converter with 8 Channels
Features of PIC 16C74
4K X 14 bits of program memory.
256 bytes of data memory ( includes general
purpose and special purpose reg).
Inbuilt PWM generation(CCP 1 and CCP2)
12 independent Interrupt sources
It has most power full instruction set having 35
instruction.
Power On Reset feature
Brown Out Rest feature
Memory Organization
Memories available in PIC micro controller are
classified as follows.
1. Program Memory
2. Data Memory
Program Memory
PIC 16C7X series micro controller has 13 bit
program counter. Hence It can map memory
space with (0000h to 1FFFh).
Data Memory
It has two register banks(Bank 0 and Bank1 )
and each bank having 128 bytes of memory.
Appropriate bank is selected as using RP0 bit
STATUS register.
Some Special Register
STATUS Register
W- Register
FSR(File Selection Register
INDF
Program counter(PC)
PCL(8 bits)
PC Lath(Lower 5 bits are used)
Program counter(PC) (8 Level)
Pin Configuration of PIC 16C74A
Addressing Modes
Direct Addressing
In-direct addressing
Instruction set
PIC 16C74A has only 35 instruction.
Most of the instructions are byte oriented and it
requires two parameters.
First Parameter: Name of SPR or GPR
Second Parameter : Destination of the result
F- Destination ->source
W -Destinaion->Work register
Bit oriented instruction also have two parameters
First parameter name of the data memory
Second bit address of the particular memory
List of Instruction
1. bcf f, index
1. Ex: bcf STATUS , RP0
2. Ex: bcf STATUS , 5
2. bsf f, index
3. clrw
4. clr f
5. movlwk
1. Ex : movlw30h
2. Ex : movlw20
List of Instruction
6. movf f, F(W)
F(w) can be replaced by F or W
Ex: movf INDF, W
Ex movf INDF, F
7. movwf, f
- moves w to f
- ex : movwf TMR0 ( w to TMR0)
List of Instruction
8. swapf f, F(W)
- Ex: swapf 30h , F
9. andlwk
-Ex: andlw10h
10. andwf f, F(W)
-Ex: andwf TMR1L, F
List of Instruction
11. iorlwk
12. iorwf f, F(W)
13. xorlwk
14. xorwf f, F(W)
List of Instruction
15. addlwk
- Ex: addlw33h(w=w+33h)
16. addwf f, F(W)
- Ex: addwf PORT A, F(PORT A=W+PORT A)
- Ex: addwf PORT A, W(W=W+PORT A)
17.sublw k
- Ex: sublw22h (W=W-22h)
List of Instruction
18. subwf f, F(W)
19. rlf f, F(W)
- Ex: rlf PORT A, W
20. rrf f, F(W)
- Ex: rrf PORT B, F
List of Instruction
21. btfscf, index
- Ex: btfscSTATUS , 2 (Check for ZERO flag)
22. btfssf, index
- Ex: btfscSTATUS, 0 (Check for CARRY flag)
23. decf f, F(W)
24. incf f, F(W)
25. comf f, F(W)
List of Instruction
26. decfszf, F(W)
- Ex : decf 65h, F (Check for Zero)
27. incfszf, F(W)
-Ex: incfcz66h, F (Check for Zero)
28. gotolabel
29. call label
30. return
31. retlwk
32. retfie(Re-enable interupts)
List of Instruction
33. nop
34.clrwdt
35. sleep
Sample Programs
1. Addition of two nos:
movlw02h ;
addlw32h;
Sample Programs
2. Addition of array of nos.
- Array of 5 nosstored in RAM location starts
from 20h
COUNT EQU 05;
movlwCOUNT;
movwf 30h;
movlw20h;

S-ar putea să vă placă și