Académique Documents
Professionnel Documents
Culture Documents
What is an embedded
system?
It
It
Faster is better.
Criteria:
Criteria:
cost
power consumption
predictability
cost
average speed
et us begin with
CHAPTER 1
DIGITAL FUNDAMENTALS
NUMBER REPRESENTATION
Decimal
0
1
2
3
4
5
6
7
8
Binary
0
01
10
11
100
101
110
111
1000
1001
1010
1011
1100
1101
1110
1111
9
10
11
12
13
14
15
Base
Base 2
Hex
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
Base
NUMBER REPRESENTATION
Bit
0/1
0/1
Nibble
0
0 0
0 0
0 0
0
Byte
0
0 0
0 0
0 0
00
0 0
0 0
0 0
0
Word
0
0 0
0 0
0 0
00
0 0
0 0
0 0
00
0 0
0 0
0 0
00
0 0
0 0
0 0
0
23
2
2
11
2
2
1
0
2310 =
128
64
32
16
Place value
Binary value
Decimal value
1*1+1*2+1*8=11
MSB
Result =
1*1+1*2
LSB =3
B3 H
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
BINARY NOT
LOGIC
1
0
Not lo
gic
comp
lemen
ts the
voltag
e leve
l
=0
=1
For what???
Binary or logic
1 0 1 1 0 0 0
0 0 0 0 0 1 1
1 0 1 1 0 1 1
For what???
1 1
Masking:
bits
1 1Discarding
1
keeping needed bits
0 1 1 alive
For what ?
For what ?
Comparing two
sequences
5 Volt Pin of IC
GND pin of IC
MEMORY ORGANIZATION
7F
INTERNAL RAM
R2
User Ram
0
B7
If r2=3C
Register bank
07 r7 r6 r5 r4 r3 r2 r1 r0
00
80 TO FF are SFRs
0
B0
3F12
MOV A,r0
3F13
ADD A,#0B
Program memory
Address of P.G
3F14
Address bus
3F13
3F12
3F14
Program
counter
Instruction decoder
r0
0
EXECUTING
Reading
Decoding
command
commands
OR Fetch cycle
0
0
1
0
0
0
1
1
COMMANDS
or PORTS.
from program
until
JUMP INSTRUCTION
LJMP and SJMP are used to Change the flow of
commands.
Program memory
1F0
0
1F01
ADD
ADD B,#F3
B,#F3
L JMP 3A20
1F02
3A20
Program counter
1F00
1F01
1F02
3A20
MOV A,r1
3A21
MOV P2,A
3A22
02CA
LCALL A018
02CB
MOV A,P2
02CC
vv
CALL Instruction
2101
Program Counter
2100
2101
2102
LCALL A108
A108
02CA
02CB
2100
0B
A108
A109
A10A
MOV A,@R1
RRA
RRA
A10B
RRA
A10C
A10D
RRA
RET
0A
07
07
08
09
Stack
Pointer.
07
08
STACK
Addressing.
1.
R1or R0.
branch can be
anywhere within the 64K byte Program Memory address space.
addr 11:------- 11-bit destination address. Used by ACALL and
AJMP. The branch will be
within the same 2K byte page of program memory as the first byte
of the
following instruction.
rel :------Signed (twos complement) 8-bit offset byte. Used by
SJMP and all
conditional jumps. Range is -128 to +127 bytes relative to first byte
of the
following instruction.
Bit:----- Direct Addressed bit in Internal Data RAM or Special
Function Register.
Examples of instructions.
MOV A,Rn
MOV
Examples of instructions.
* MOV
OSCILLATOR
TIMER/COUNTER
SERIAL COMMUNICATION
Timer T0
TIMER-0 PROGRAMMING
1 . M O D E C O N F I G U R AT I O N
2.TURN ON TIMER
The TR0 bit is set and the timer starts operation. If the
quartz crystal with frequency of 12MHz is embedded then
its contents will be incremented every microsecond.
15536 3CB0
Timer T1