



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A part of the lecture notes for ece 447 - microcontroller applications, specifically lecture 7. It covers the arithmetic operations of the mc68hc11 microcontroller for both unsigned and signed numbers. The concepts of weights, unsigned and signed number representations, and arithmetic instructions. It also discusses the condition code register flags, including the zero, negative, carry, and overflow flags.
Typology: Study notes
1 / 7
This page cannot be seen from the preview
Don't miss anything!




weights 128 64 32 16 8 4 2 1
weights -128 64 32 16 8 4 2 1
i=
7
i=
6
7 0111 1111 0111 0111 6 0110 1110 0110 0110 5 0101 1101 0101 0101 4 0100 1100 0100 0100 3 0011 1011 0011 0011 2 0010 1010 0010 0010 1 0001 1001 0001 0001 0 0000 1000 0000 0000 -0 1000 1111 -1 1001 0111 1111 1110 -2 1010 0110 1110 1101 -3 1011 0101 1101 1100 -4 1100 0100 1100 1011 -5 1101 0011 1011 1010 -6 1110 0010 1010 1001 -7 1111 0001 1001 1000 -8 0000 1000
Signed- magnitude Biased Two’s complement
One’s complement
Two’s complement representation of signed numbers
-8 -7 -6 -5 -4 -3 -2 -1 0 1 2 3 4 5 6 7
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
k =
(^0) X +2 k^ = X+
Definition of the Condition Code Register flags (2)
C = 1 if result > MAX_UNSIGNED or result < 0 0 otherwise where MAX_UNSIGNED = 2^8 -1 for 8-bit operands (registers A, B) 216 -1 for 16-bit operands (register D)
V = 1 if result > MAX_SIGNED or result < MIN_SIGNED 0 otherwise where MAX_SIGNED = 27 -1 for 8-bit operands (registers A, B) 215 -1 for 16-bit operands (register D) MIN_SIGNED = -2^7 for 8-bit operands (registers A, B) -2^15 for 16-bit operands (register D)
Carry flag - C
Overflow flag - V
out-of-range for unsigned numbers
out-of-range for signed numbers
Overflow for signed numbers (1)
Overflow for signed numbers (2)
Arithmetic instructions (1)
1. addition Acc + M ü Acc
2. subtraction Acc – M ü Acc
SUB [A, B, D] SBC [A, B]
3. negation -X
Extending the number of bits of a signed number
xk -1 xk -2 … x 1 x 0
yk’ -1 yk’ -2 … yk yk -1 yk -2 … y 1 y 0
two’s complement
xk -1 xk -1 xk -1... xk -1 xk -2 … x 1 x 0