Title: Microcontrollers
1Microcontrollers
- Introduction to Computing
2Numbering and Coding Systems
- Decimal and binary number
Convert 2510 to binary. Solution Quotient Remai
nder 25/2 12 1 (LSB)12/2 6 06/2 3 03/2
1 11/2 0 1 (MSB)
2510 110012
3Numbering and Coding Systems
- Converting from binary to decimal
Convert 110012to decimal Weight 16 8 4 2 1 Digit
s 1 1 0 0 1 Sum 16 8 0 0 1 2510
4Numbering and Coding Systems
- Use the concept of weight to convert 3910 to
binary.
Weight 64 32 16 8 4 2 1Multiplier 0 1 0 0 1 1 1
0 32 0 0 4 2 1 39Therefore,
39101001112
5Numbering and Coding Systems
- Represent binary 100111110101 in hex
Binary 1001 1111 0101Hex 9 F 5 Therefo
re, 1001111101012 9F516
6Numbering and Coding Systems
- Convert hex 29B to binary
Hex 2 9 B Binary 0010 1001 1011 Therefore
, 29B16 0010 1001 1011 or 10 1001
1011 (Normally, in any machine all binary
numbers are expressed with the same number of
bits so it is uncommon to drop leading zeros.)
7Numbering and Coding Systems
- Convert decimal 45 to hex
Weights 64 32 16 8 4 2 1 Multipliers 0 1 0 1 1
0 1 Therefore, binary 0010 1101 is decimal
45. Therefore, hex 2D is decimal 45.
8Numbering and Coding Systems
- Convert hex 6B2 to decimal.
Hex 6 B 2Binary 0110 1011 0010 Weights 211
210 29 28 27 26 25 24 23 22 21
20Multipliers 0 1 1 0 1 0 1
1 0 0 1 0 21029 27
2524 21 102451212832162
171410 Therefore, decimal 1714 hex 6B2.
9Numbering and Coding Systems
- The Binary addition facts
10Numbering and Coding Systems
- Add binary numbers using the binary addition
facts
Add 1101 to 1001
11Numbering and Coding Systems
12ASCII Code
- American Standard Code for Information
Interchange - 0 to 9, upper and lower case alphabet, control
codes, punctuation - Allows info to be shared among computers
- 7 bits
- Table on page 401 of MM text
13Logic Gates
- AND, OR are the primitives.
- NAND, NOR are the universals
- Buffers, Inverters are single input gates
- XOR and NXOR are odd and even detectors
14Combinational Logic
- Output is determined by the current inputs only
- Adders, Half Adders, Decoders, Encoders, Mux, and
Demux.
15Sequential Logic
- Output is determined by current and previous
state of inputs. - Flip-Flops, Latches
16Computer Organization
- Central Processing Unit (CPU)
- Microprocessor (uP)
- Microcontroller (uC)
- Memory
- ROM
- RAM
- Peripherals
- Printer
- Keyboard
- Monitor
17Busses
- A related group of nodes (conductors)
- Address
- Unidirectional
- Data
- Bi-directional
- Control
- Rarely grouped
18Binary Patterns
- Bit (1 or 0)
- Nibble (4 bits)
- Byte (8 bits)
- Word (16 bits is common but not standard)
- Kilobyte (210 or 102410 bytes)
- Megabyte (220 or 1 048 57610 bytes)
- Gigabyte (230 or 1 073 741 82410 bytes)
19Memory Basics
- ROM Read Only Memory
- Permanent information
- Boot-up programs (diagnostics)
- Subroutines used by many applications
- Application memory if only one application
- Data memory if data set is constant
20Memory Basics
- RAM Random Access Memory
- Better Name Read / Write memory
- Information can be changed
- Application memory if multiple applications
- Data memory if data must be changeable
- Faster operation
21Buses Connect CPU and RAM
Data Bus
CPU
RAM
Address Bus
22Buses connect the CPU with ROM
Data Bus
CPU
ROM
Address Bus
23Application Memory
uC RAM
uP RAM Various Applications
uC ROM Single Application
uP ROM
Microprocessor Computers
Microcontroller Computers
(Embedded
System)
24Fetch Execute Machine Cycle
Fetch Instruction
Execute Instruction
One machine cycle
25The 8051 Machine Cycle
- One machine cycle requires 12 periods of the
clock - One period 1/Clock Frequency
- 12MHz clock has a period of .083uS.
- 12MHz clock as a machine cycle time of 1uS.
26Program Counter
- 16 bit program (ROM) addresses only.
- After execution, PC always contains the address
of the very NEXT instruction. - Always contains 0000h at Reset.
- Largest ROM address is FFFFh.
27Reset Vector
- Reset Vector (0000H) cannot be changed.
- At the Reset event, 0000H is automatically loaded
into the program counter. - The instruction stored at ROM 0000H is always
executed at start-up.
28Running a Program
PC 1400, ACC ?
PC 1402, ACC 21h
PC 1404, ACC 63h
PC 1406, ACC 75h
This instruction repeats itself
PC 1406
298051 Series Microcontrollers
- Many varieties.
- On chip ROM (Flash)
- On chip RAM
- I/O points
- Timers
- Interrupts
- Vcc
- Packages
- One instruction set