EEE 212 Week 1.Ppt - Bilkent
EEE 212 Week 1.Ppt - Bilkent
EEE 212 Week 1.Ppt - Bilkent
multiply the decimal fraction by the radix save the whole number part of the result repeat above until fractional part of step 2 is 0 0.125 = ? b 0.78125 = ? h
Twos complement
Decimal -128 -127 -126 -2 -1 0 1 +127 0111 1111b 1111 1110b 1111 1111b 0000 0000b 0000 0001b Binary 1000 0000 b 1000 0001b 1000 0010b Hex 80h 81h 82h FEh FFh 00h 01h 7Fh
Numbers in the range from -27 to 27-1 are represented by 8 bit signed arithmetic
ASCII
The standard for text In this code each letter of the alphabet, punctuation mark, and decimal number is assigned a unique 7-bit code number With 7 bits, 128 unique symbols can be coded Often a zero is placed in the most significant bit position to make it an 8-bit code
e.g., Uppercase A 41h
ASCII - more
BCD
BCD code provides a way for decimal numbers to be encoded in binary form that is easily converted back to decimal
26 (unsigned binary)=> 1Ah = 0001 1010 b 26 (BCD)=>26h=0010 0110 b 243 (unsigned binary)=> F3h= 1111 0011 b 243 (BCD)=>243h=> 0010 0100 0011 b
Digital Primer
Inversion
10
XOR Gate
11
12
13
14
Multiplexer
A A B S B Z S Z
15
N to 2N Decoder
16
Address decoders
17
Latch
The simplest memory element Level-sensitive: it memorizes the input data when there is a given level on the control input
18
19
20
Registers
21
Tri-state Buffers
Tri-state Transistor circuit for inverting tri-state buffer:
high impedance (output disconnected)
Variations
Inverting buffer
Inverted enable
transmission gate
22
Tri-state Buffers
Tri-state buffers are used when multiple circuits all connect to a common bus. Only one circuit at a time is allowed to drive the bus. All others disconnect.
Bidirectional connections:
Busses:
23
24
25
26
Today the CPU circuitry has been reduced to ICs called the microprocessor, the entire computer with the three parts is called a microcomputer
27
The basic timing of the computer is controlled by a square wave oscillator or a clock generator circuit.
Synchronization Determines how fast the program can be fetched from memory and executed
The memory units address selector/decoder circuit examines the binary number on the address line and selects the proper memory location to be accessed.
29
The width of the data bus determines how much data the processor can read or write in one memory or I/O cycle 8-bit microprocessor has an 8-bit data bus 80386SX 32-bit internal data bus, 16-bit external data bus 80386 32-bit internal and external data buses
The trick is to divide the memory into banks 32-bit microprocessor requires 4 banks of memory with each bank set up to be one-byte wide Bank enable signals are then output by the microprocessor to specify which bank to access
30
Address Bus
Address Bus
The address bus is used to identify the memory location or I/O device (also called port) the processor intends to communicate with 20 bits for the 8086 and 8088 32 bits for the 80386/80486 and the Pentium 36 bits for the Pentium II and III The total number of memory locations addressable by a given CPU is always equal to 2x where x is the number of address bits, regardless of the data bus.
Control Bus
How can we tell whether the address is a memory address or an I/O port address
Memory Read Memory Write I/O Read I/O Write
When Memory Read or I/O Read are active, data is input to the processor. When Memory Write or I/O Write are active, data is output from the processor. The control bus signals are defined from the processors point of view. Control and address lines are output lines only but the data bus is bidirectional
32
Control Bus
33
A megabyte or meg is 2^20 bytes, it is exactly 1,048,576 bytes A gigabyte is 2^30 bytes
34
35
Example Continued
Memory Address 1400h 1401h 1402h 1403h 1404h 1405h 1406h Content of memory B0h 21h 04h 42h 04h 12h F4h (the code for halt)
36
Contents of memory address (B0) the code for move to A (21) the value for A (04) the code for adding a value to A (42) the value to be added (04) the code for adding a value to A (12) the value to be added (F4) the code for halt
37
PC=1400 CPU
Inst Decoder B0 decode
MEM
Read
B0
3- B0 is decoded internally it now knows it needs to fetch the next byte!. It brings 21h from 1401. The program counter automatically increments itself to the next location to fetch the next data/instruction.
38
RAM
ROM
I/O
Timer
Address bus These general microprocessors contain no RAM, ROM, or I/O ports on the chip itself Ex. Intels x86 family (8088, 8086, 80386, 80386, 80486, Pentium) Motorolas 680x0 family (68000, 68010, 68020, etc)
39
Microcontrollers
CPU RAM ROM Serial Com Port Examples Motorolas 6811, Intels 8051, Zilogs Z8 and PIC 16X
I/O
TIMER
A microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports on one single chip; this makes them ideal for applications in which cost and space are critical Example: a TV remote control does not need the computing power of a 486
40
Microprocessor vs microcontroller
Microprocessor CPU is stand-alone, RAM, ROM, I/O, timer are separate Designer can decide on the amount of ROM, RAM and I/O ports. General-purpose Expensive Higher processing power Microcontroller CPU, RAM, ROM, I/O and timer are all on a single chip Fix amount of on-chip ROM, RAM, I/O ports Single-purpose Inexpensive For applications in which cost, power and space are critical
41
Embedded Systems
Embedded system means the processor is embedded into that application. An embedded product uses a microprocessor or microcontroller to do one task only. In an embedded system, there is only one application software that is typically burned into ROM. Table 1-1, some embedded products using microcontrollers. Examples: printer, keyboard, video game player, door opener, copier, ABS, fax machine, camera, cellular phone, keyless entry, microwave...
42
Embedded Systems
Although microcontrollers are the preferred choice for embedded systems, there are times that the microcontroller is inadequate for the task Intel, Motorola, AMD, Cyrix have also targeted the embedded market with their general purpose microprocessors For example, Power PC microprocessors (IBM Motorola joint venture) are used in PCs and routers/switches today Microcontrollers differ in terms of their RAM,ROM, I/O sizes and type.
ROM: One time-programmable, UV-ROM, flash memory
43
meeting the computing needs of the task efficiently and cost effectively
speed, the amount of ROM and RAM, the number of I/O ports and timers, size, packaging, power consumption easy to upgrade cost per unit
2.
3.
Intel 8051
1981, Intel MCS-51 The 8051 became popular after Intel allowed other manufacturers to make and market a flavor of the 8051.
different speed, amount of on-chip ROM code-compatible with the original 8051 form a 8051 family
45
8051 Features
Feature ROM RAM Timers I/O pins Serial port Interrupt sources Quantity 4K bytes 128 bytes 2 32 1 6 Notes a fixed program temporary data Timer/counter 0,1 P0,P1,P2,P3 TxD, RxD
.
46
8031 is referred as ROM-less 8051 To use ROM you must add external ROM to it but you lose two ports
47
8051 Layout
P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 RST (RXD)P3.0 (TXD)P3.1 (INT0)P3.2 (INT1)P3.3 (T0)P3.4 (T1)P3.5 (WR)P3.6 (RD)P3.7 XTAL2 XTAL1 GND 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
8051 (8031)
40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21
Vcc P0.0(AD0) P0.1(AD1) P0.2(AD2) P0.3(AD3) P0.4(AD4) P0.5(AD5) P0.6(AD6) P0.7(AD7) EA/VPP ALE/PROG PSEN P2.7(A15) P2.6(A14) P2.5(A13) P2.4(A12) P2.3(A11) P2.2(A10) P2.1(A9) P2.0(A8)
48
Timer 1 Timer 0
OSC
Bus Control
4 I/O Ports
TxD RxD 4 I/O ports Address:P0,P2 Figure 1-2. Inside the 8051 Microcontroller Block Diagram
49
P0 P1 P2 P3
Type
SRAM DRAM Masked ROM PROM
Volatile?
Yes Yes No
Speed
Fast Moderate Fast
No
n/a
n/a
Moderate
Fast
EPROM
No
Entire Chip
Moderate
Fast
EEPROM
No
Yes
Byte
Expensive
Flash
No
Yes
Sector
Moderate
NVRAM
No
Yes
Byte
Unlimited
Fast
50
OTP (one-time-programmable) version of the 8051 8051 family from Philips Note
Memory is the biggest difference between them; see Chapters 14 and Chapter 15.
51
DS89C420/430/
In the lab experiments, well use the MDE8051 trainer which uses the Dallas (now part of Maxim) DS89C420/430.
52
Atmels products
53