2013 Lecture Ch0
2013 Lecture Ch0
Introduction to
PIC
Microcontroller
Numbering and Coding systems
0-2
The decimal system (base 10)
The word decimal is derived from the Latin root decem
(ten). In this system the base b = 10 and we use ten symbols
S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
S = {0, 1}
Solution
We first arrange the binary number in 4-bit patterns:
Note that the leftmost pattern can have one to four bits. We then
use the equivalent of each pattern shown in Table 2.2 on page 25
to change the number to hexadecimal: (4E2)16.
Example 2.20
Solution
Each hexadecimal digit is converted to 4-bit patterns:
0-17
Digital Primer
0-18
A pictorial representation of AND, OR, XOR,
and NOT gates as well as their input and
output values
0-19
Two Implementations of a Half-
Adder
Block Diagram of a Half-Adder
Full-Adder Built From a Half-Adder
3-Bit Adder Using Three Full-
Adders
Address Decoders
Constructing a flip-flop
0-25
D Flip-Flops
Inside the Computer
Memory cells arranged by address
0-28
Internal Organization of a
Computer
Internal Block Diagram of a CPU
Figure 2.8 The machine cycle
© 2007
Pearson
Addison-
Wesley.
All rights
0-31
reserved
Microprocessor vs. microcontroller
(MCU)
• Microprocessor
– A processor implemented on a very large scale integration
(VLSI) chip
– Peripheral chips are needed to construct a product
• Microcontroller
– The processor and peripheral functions implemented on one
VLSI chip
• Embedded systems
• SOC (system on chip)
32
Microprocessor vs. microcontroller
(MCU)
33
Simplified view of a PIC
microcontroller
34
PIC microcontroller vs. Intel MCS-51 (8051)
8-bit ALU
Intel's original in the 1980s.
Several companies offer MCS-51 as IP cores in FPGAs or
ASICs.
68HC MCU and AVR
68HC microcontroller
8-bit microcontroller family introduced by Motorola in 1985.
Now produced by Freescale Semiconductor
CISC (complex instruction set computer) design
AVR
8-bit RISC MCU was sold to Atmel from Nordic VLSI
36
Features of PIC18 MCU
• 8-bit CPU
• Program ROM (read-only memory)
– UV-EROM (erasable programmable ROM): need 20 minutes to erase
– Flash (Electrical EPROM, EEPROM)
– OTP (one-time-programmable) version: mass production
– Masked version: burning program during IC fabrication
• Data RAM (random access memory)
– A maximum of 4096 bytes
– Some PIC18s use EEPROM to store critical data that are not changed not often.
37
Features of PIC18 MCU
• Timers
• Pulse-width modulation (PWM)
• Parallel I/O ports
• SPI, I2C, controller area network (CAN) serial interface
• Universal asynchronous receiver transmitter (UART)
• 10-bit A/D converter
38