2. Analogue vs Digital
Analogue
* Continuous range of value
* Precision limited by Noise
Digital
* Discrete range of values
* Precision limited by number of “Bit”
4. Analogue vs Digital
The real world is analogue ( by because
all signal in world be shape analogue)
But in controlling, Digital one had using
for process.
Both of signal had been converter each
other
5. Analoge vs Digital
Analogue A to D
Digital
Processing
D to A Analogue
Why Digital Only by using in Processing?
^ Adventure in integrated Circuit has made the complex processing of
digital data.
^ Digital Control processing has made easier than analogue
^ Digital circuits are inherently more noise resistant
6. Digital and Boolean
Digital represented by boolean logic
Boolean is the name of mathematician’s
expert
Now boolean is called by conventional
logic because there is new logic that
called by fuzzy logic
But all electronic still using boolean logic
to processing the controlling system
7. Why Boolean
It is convenient in electrical system to use a two-value
system to represent value true/false, on/off, yes/no
and 1/0
* Two voltage or current levels can be used
* Easier to process and distribute reliably (diandalkan)
* Don’t think of them as numbers (even though we often
represent them as 0/1 for brevity(ketangkasan))
The need for binary numbers
* Multi-value quantities need to be represented in the
digital system. Therefore need numbers made up from
the simple two value system
8. Number System
Decimal base 10 0 1 2 3 4 5 6 7 8 9
Biner base 2 0 1
Octal base 8 0 1 2 3 4 5 6 7
Hexadecimal base 16 0 1 2 3 4 5 6 7 8 9
A B C D E F
10. Unsigned binary numbers
1100.101
1 x 2-3
= 0.125
0 x 20
= 0.000
0 x 21
= 0.000
1 x 22
= 4.000
1 x 23
= 8.000
0 x 2-2
= 0.000
1 x 2-1
= 0.500
Binary point
Each bit of the
Number may be
Representaed by
A Boolean value
Binary, weightings are powers of 2
14. Hexadecimal Numbers
660
: 164
41
: 169
2
Hexadecimal : 294 Hex
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
215
: 1613
7
Hexadecimal : 7D Hex
15. Hexadecimal Numbers
660 0010 1001 0100
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
2 9 4
215 0000 1101 0111
0 D 7
16. Decimal to Binary
Number = 36.37
5
Base = 2
Decimal
Number
Binary
Digits
Converter Number
0 0 0100100.0110
0.5 1 0100100.011
0.75 1 0100100.01
0.375 0 0100100.0
36 0 0100100
18 0 010010
9 1 01001
4 0 0100
2 0 010
1 1 01
0 0 0
Generete each digit by successive division
Or multiplication.
There is no guarantee the fraction will be
finite
Fractional part – Multiplication by base
Whole part – divition by base
18. Binary Addition
190 + 141 =331
1 0 1 1 1 1 1 0
1 0 0 0 1 1 0 1
110
1
1
1
0
1
0
1
101
Carry out of
8-bit number
1
Carry out of
Each column
19. Binary Subtraction
229 – 46 = 183
1 1 1 0 0 1 0 1
0 0 1 0 1 1 1 0
1
1
2
1
1
2
10
1
2
1
2
1
1
2
101
Borrow out
Borrow in from
Left column
A borrow-out of 1 from
This column becomes a borrow in
of 2 in this column
Both rows subtracted
20. Exercise
Convert to 8-bit binary and do the
arithmetic operation
* 120 + 54 * 110 + 100
* 224 – 134 * 200 + 20
* 112 – 89 * 111 – 25
Convert back to decimal and check the
result
21. Binary Number Circle
4 – bit
Binary
Number Circle
In real hardware there is a fixed number
Of bits available. We often ignore leading zeros
But they are still there!
Examlpe :
If we only use 4 bits then the binary
Counting sequence “wraps around”
At 15 ↔ 0
11 - 1 = 10
11 1011
- 1 1
10 1010
22. Binary Number Circle
4 – bit
Binary
Number Circle
Subtracting across the boundary
Still “works” if you think of result
As the distance on the number
Circle.
(Module arithmetic – ignore
The borrow /carry)
8 1000
- 14 - 1110
10 (-1)1010
23. Representing –ve Number
Several choices for notation
* sign + magnitude notation
* 1’s complement
* 2’s complement notation
* various ‘excess codes ‘
24. Sign Number – sign + magnitude
Notation
Sign Bit Magnitude
0 +ve Simple binary number
1 - ve
Problem ?
How about Null or Zero
+ 0 0000
- 0 1000
25. Signed Numbers – Sign +
magnitude Notation
Arithmetic
Difficult to do – have to work out that operation to
perform
5 + -6 actually calculate –(6-5) i.e. exchange the
operands and do subtraction!
-5+ -6 actually calculate –(5+6) i.e. negate the addition
of the negated numbers !
Required action depends the signs of the numbers
and on which has the large magnitude. Natural for us
–a bit hard for the computer since the only way it can
work out the bigger number is to do a subtraction!
27. Sign Numbers – 2’s
Complement
As for straight binary numbers but with the
weighting of the most significant bit being
negative
Example
* 4 bit – weights are -8, 4,2,1
* 8 bit – weights are -128, 64,32,16,8,4,2,1
Need to know how many bits are being used
to work out the value of the number – don’t
omit leading zeroes
28. Sign Numbers – 2’s
Complement
1100.101
1 x 2-3
= 0.125
0 x 20
= 0.000
0 x 21
= 0.000
1 x 22
= 4.000
1 x 23
= -8.000
0 x 2-2
= 0.000
1 x 2-1
= 0.500
Binary point
Sign Bit
Binary, weightings are powers of 2
-4.375
34. Exercise
For 4 Digit :
1. 7 + (-5)
2. -6 + -1
3. 3 + 4
4. 2 + 3
5. -4 + 7
Converse all item to digital and addition.
And then Converse to decimal again
37. Exercise
for 4 digit . Converse decimal above to
digit and subtraction. After that
converse to decimal again :
1. (+3) – (-3)
2. (-4) – (+2)
3. (-8)- (+4)
4. (-3) – (-4)
5. (7) – (5)
38. 2’s Complement ALU
Addition and subtraction use the same rules as
unsigned binary.
Same hardware may be used for both
Carry (C) is used for unsigned, overflow (v) for signed
C=Carry
V=overflow
OP
Signed Numbers
Signed Numbers
C=Carry
V=overflow
OP
Signed Numbers
Signed Numbers
The same
hardware
Arithmetic Flags in
Condition code register (CCR)