Introduction To PIC Microcontroller: Lecturer: DR Abd Rahman Tamuri, DR Yaacob Mat Daud
Introduction To PIC Microcontroller: Lecturer: DR Abd Rahman Tamuri, DR Yaacob Mat Daud
Lecturer: Dr Abd Rahman Tamuri, Dr Yaacob Mat Daud Physics Department, Faculty of Science, Universiti Teknologi Malaysia, 81310, JB
Lecture 04
More on Microcontrollers
Microcontrollers integrate all the components of a computer system onto a single chip All components are optimized to perform the functions necessary to control a larger system Size, capability, cost, and power consumption are more important considerations 8 bit microcontrollers have the majority of the market right now, but 16 and 32 bit microcontrollers are available and gaining market share
Lecture 04
Common Microcontrollers
PIC MICROCONTROLLER
PIC MICROCONTROLLER
The PICmicro was originally designed around 1980 by General Instrument as a small, fast, inexpensive embedded microcontroller with strong I/O capabilities. PIC stands for "Peripheral Interface Controller". General Instrument recognized the potential for the PIC and eventually spun off Microchip, headquartered in Chandler, AZ to fabricate and market the PICmicro.
PIC MICROCONTROLLER
PIC Microcontroller
Range of low end 8 bit microcontrollers. Smallest have only 8 pins, largest 40 pins. Typical chip is an 18 pin one. Very cheap, you can pick them up at less than 1 each. Targeted at consumer products, burglar alarms etc.
Advantages of PIC It is a RISC (Reduced Instruction Set Computer) design Only thirty seven instructions to remember Its code is extremely efficient, allowing the PIC to run with typically less program memory than its larger competitors. It is low cost, high clock speed
PIC MICROCONTROLLER
Harvard architecture Like many micros the PIC is a Harvard not a von-Neumann machine This is simpler and faster Separate program bus and data bus: can be different widths! For example, PICs use: Data memory (RAM): a small number of 8bitregisters Program memory (ROM): 12bit, 14bit or 16bit wide (in EPROM, FLASH, or ROM)
PIC MICROCONTROLLER
PIC MICROCONTROLLER
Harvard architecture is a newer concept than von-Neumann's. It rose out of the need to speed up the work of a microcontroller. In Harvard architecture, Data Access and Address Access are separate. Thus a greater flow of data is possible through the central processing unit. PIC16F877 uses 14 bits for instructions which allows for all instructions to be one word instructions. Advantages of Harvard model An add operation of the form a:=b+c must fetch 2 operands from memory and write 1 operand to memory. In addition it is likely to have to fetch 3 instructions from memory. With a single memory this will take 6 cycles. With 2 memories, we can fetch the instructions in parallel with the data and do it in 3 cycles. We have different word lengths for instructions and data 8 bit data and perhaps 12 bit instructions.
PIC MICROCONTROLLER 10
Harvard
Von- Neumann
Data Memory 8
CPU 14
Program Memory
CPU 8
Program Memory
PIC MICROCONTROLLER
11
PIC MICROCONTROLLER
12
PIC MICROCONTROLLER
13
PIC MICROCONTROLLER
14
PIC MICROCONTROLLER
15
The PIC Family: Program Memory PIC program space is different for each chip. Some examples are: 12C508 512 12bit instructions 16C71C 1024 (1k) 14bit instructions 16F877 8192 (8k) 14bit instructions 17C766 16384 (16k) 16bit instructions
PIC MICROCONTROLLER
16
PIC MICROCONTROLLER
17
The PIC Family: Data Memory PICs use general purpose file registers for RAM (each register is 8bits for all PICs) Some examples are: 12C508 25 Bytes RAM 16C71C 36 Bytes RAM 16F877 368 Bytes (plus 256 Bytes of nonvolatile EEPROM) 17C766 902 Bytes RAM Dont forget, programs are stored in program space (not in data space), so low RAM values are OK.
PIC MICROCONTROLLER
18
PIC MICROCONTROLLER
19
PIC MICROCONTROLLER
20
PIC MICROCONTROLLER
21
PIC MICROCONTROLLER
22
PIC MICROCONTROLLER
23
PIC MICROCONTROLLER
24
PIC MICROCONTROLLER
25
PIC MICROCONTROLLER
26
PIC MICROCONTROLLER
27
Lecture 04
More on Microcontrollers
Microcontrollers integrate all the components of a computer system onto a single chip All components are optimized to perform the functions necessary to control a larger system Size, capability, cost, and power consumption are more important considerations 8 bit microcontrollers have the majority of the market right now, but 16 and 32 bit microcontrollers are available and gaining market share
Lecture 04
Common Microcontrollers
PIC MICROCONTROLLER
PIC MICROCONTROLLER
The PICmicro was originally designed around 1980 by General Instrument as a small, fast, inexpensive embedded microcontroller with strong I/O capabilities. PIC stands for "Peripheral Interface Controller". General Instrument recognized the potential for the PIC and eventually spun off Microchip, headquartered in Chandler, AZ to fabricate and market the PICmicro.
PIC MICROCONTROLLER
PIC Microcontroller
Range of low end 8 bit microcontrollers. Smallest have only 8 pins, largest 40 pins. Typical chip is an 18 pin one. Very cheap, you can pick them up at less than 1 each. Targeted at consumer products, burglar alarms etc.
Advantages of PIC It is a RISC (Reduced Instruction Set Computer) design Only thirty seven instructions to remember Its code is extremely efficient, allowing the PIC to run with typically less program memory than its larger competitors. It is low cost, high clock speed
PIC MICROCONTROLLER
Harvard architecture Like many micros the PIC is a Harvard not a von-Neumann machine This is simpler and faster Separate program bus and data bus: can be different widths! For example, PICs use: Data memory (RAM): a small number of 8bitregisters Program memory (ROM): 12bit, 14bit or 16bit wide (in EPROM, FLASH, or ROM)
PIC MICROCONTROLLER
PIC MICROCONTROLLER
Harvard architecture is a newer concept than von-Neumann's. It rose out of the need to speed up the work of a microcontroller. In Harvard architecture, Data Access and Address Access are separate. Thus a greater flow of data is possible through the central processing unit. PIC16F877 uses 14 bits for instructions which allows for all instructions to be one word instructions. Advantages of Harvard model An add operation of the form a:=b+c must fetch 2 operands from memory and write 1 operand to memory. In addition it is likely to have to fetch 3 instructions from memory. With a single memory this will take 6 cycles. With 2 memories, we can fetch the instructions in parallel with the data and do it in 3 cycles. We have different word lengths for instructions and data 8 bit data and perhaps 12 bit instructions.
PIC MICROCONTROLLER 10
Harvard
Von- Neumann
Data Memory 8
CPU 14
Program Memory
CPU 8
Program Memory
PIC MICROCONTROLLER
11
PIC MICROCONTROLLER
12
PIC MICROCONTROLLER
13
PIC MICROCONTROLLER
14
PIC MICROCONTROLLER
15
The PIC Family: Program Memory PIC program space is different for each chip. Some examples are: 12C508 512 12bit instructions 16C71C 1024 (1k) 14bit instructions 16F877 8192 (8k) 14bit instructions 17C766 16384 (16k) 16bit instructions
PIC MICROCONTROLLER
16
PIC MICROCONTROLLER
17
The PIC Family: Data Memory PICs use general purpose file registers for RAM (each register is 8bits for all PICs) Some examples are: 12C508 25 Bytes RAM 16C71C 36 Bytes RAM 16F877 368 Bytes (plus 256 Bytes of nonvolatile EEPROM) 17C766 902 Bytes RAM Dont forget, programs are stored in program space (not in data space), so low RAM values are OK.
PIC MICROCONTROLLER
18
PIC MICROCONTROLLER
19
PIC MICROCONTROLLER
20
PIC MICROCONTROLLER
21
PIC MICROCONTROLLER
22
PIC MICROCONTROLLER
23
PIC MICROCONTROLLER
24
PIC MICROCONTROLLER
25
PIC MICROCONTROLLER
26
PIC MICROCONTROLLER
27