introduction to pic 16c74x microcontroller
TRANSCRIPT
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
1/25
Introduction to PIC 16C74X
MicrocontrollerBy,
Arulselvam K
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
2/25
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.
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
3/25
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
4/25
Features of PIC 16C74
8 Bit microcontroller having 40 pins.
It has 33 I/O pins for connecting peripheral devices. (5ports)
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
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
5/25
Features of PIC 16C74
4K X 14 bits of program memory.
256 bytes of data memory ( includes generalpurpose 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
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
6/25
Memory Organization
Memories available in PIC micro controller are
classified as follows.
1. Program Memory2. Data Memory
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
7/25
Program Memory
PIC 16C7X series micro controller has 13 bit
program counter. Hence It can map memory
space with (0000h to 1FFFh).
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
8/25
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
9/25
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 bitSTATUS register.
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
10/25
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
11/25
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)
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
12/25
Pin Configuration of PIC 16C74A
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
13/25
Addressing Modes
Direct Addressing
In-direct addressing
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
14/25
Instruction set
PIC 16C74A has only 35 instruction.
Most of the instructions are byte oriented and itrequires 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 parametersFirst parameter name of the data memory
Second bit address of the particular memory
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
15/25
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. movlw k1. Ex : movlw 30h
2. Ex : movlw 20
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
16/25
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. mov wf, f
- moves w to f
- ex : movwf TMR0 ( w to TMR0)
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
17/25
List of Instruction
8. swapf f, F(W)
- Ex: swapf 30h , F
9. andlw k-Ex: andlw 10h
10. andwf f, F(W)
-Ex: andwf TMR1L, F
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
18/25
List of Instruction
11. iorlw k
12. iorwf f, F(W)
13. xorlw k
14. xorwf f, F(W)
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
19/25
List of Instruction
15. addlw k
- Ex: addlw 33h(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: sublw 22h (W=W-22h)
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
20/25
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
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
21/25
List of Instruction
21. btfsc f, index
- Ex: btfsc STATUS , 2 (Check for ZERO flag)
22. btfss f, index- Ex: btfsc STATUS, 0 (Check for CARRY flag)
23. decf f, F(W)
24. incf f, F(W)25. comf f, F(W)
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
22/25
List of Instruction
26. decfsz f, F(W)
- Ex : decf 65h, F (Check for Zero)
27. incfsz f, F(W)
-Ex: incfcz 66h, F (Check for Zero)28. goto label
29. call label
30. return
31. retlw k32. retfie (Re-enable interupts)
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
23/25
List of Instruction
33. nop
34.clrwdt
35. sleep
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
24/25
Sample Programs
1. Addition of two nos:
movlw 02h ;
addlw 32h;
-
8/12/2019 Introduction to PIC 16C74X Microcontroller
25/25
Sample Programs
2. Addition of array of nos.
- Array of 5 nos stored in RAM location startsfrom 20h
COUNT EQU 05;
movlw COUNT;
movwf 30h;
movlw 20h;