Homework 01 (0)
Homework a)123/2= 61,5; 61/2=30,5; 30/2=15; 15/2=7,5; 7/2= 3,5; 3/2=1,5
(1111011)
0.456*2=0.912; 0,912*2=1,824; 0,824*2=1,648; 0,648*2=1,296; 0,296*2=0,592; 0,592*2=1,184; 0,184*2=0,368; 0,368*2=0,736; (0,736*2=1,472; 0,472*2=0,944; 0,944*2=1,888)
So
b)123/16=
7,6875 ; 0,6875*16=11 ; 7/16 is less than one, then hex is 7B
0,456*16=
7,296 ; 0,296*16=4,736; 0,736*16=11,776; 0,776*16=12,416; 0,416*16=6,656; 0,656*16=10,496; 0,496*16=7,936; 0,936*16=14,976;
0,976*16=15,616; 0,616*16=9,856; 0,856*16=13,696; 0,696*16=11,136;
0,136*16=2,176; 2,176*16=2,816; 0,816*16=13,056
Hex
is 7B.74BC6A7EF9DB22D
c)
123,456/5=24,6912/5=4,93824/5=0,987648
0,987648*5=4,93824;
0,93824*5=4,6912; 0,6912*5=3,456; 0,456*5=2,28; 0,28*5=1,4; 0,4*5=2;
0*5=0
base -5
is
d)BCD
is
a) Unsigned 16-bit binary is 0000000001101011. Hexadecimal is 6B
b) Unsigned 16-bit binary is 0000000010110101. Hexadecimal is B5
a) Signed two’s complement 16-bit binary is 0000000001101011.
Hexadecimal is 6B.
b) Signed two’s complement 16-bit binary is 1111111110110101. Hexadecimal is FFB5
a) 1111001
+1111111101000111
1111111111000000
b) 10111010
+ 10101000
1111111101100010 16- bits is suitable .
1
+=
(9+D=16; A+4+1= F; 3+2=5)
Y=X shl 3
(A and B) or ((not A) and (not B))
Y = true
for
i from 1 to 20
for
j from 1 to 8, excluding 3
bitindex
= j + (i-1)*8
if
S1[bitindex] ≠ S2[bitindex]
Y
= false
Exit loop
end
end
end
A) V and C (the operation produced an overflow and the operation produced a carry )
b)
N (The result of the operation is negative )
4
3
2
1
10
17
memory chip
a) Suitable clock frequency 0 – 400 kHz
b) The loop lasts 1 µs (1/16*4*4). The delay should be for half (5 µs) the clock period.
Connect the following pins:
MAX232:T1IN ↔ PIC:Tx
MAX232:R1OUT ↔ PIC:Rx
MAX232:R1IN ↔ RS232 :TxD
MAX232:T1OUT ↔ RS232:RxD
a)123/2= 61,5; 61/2=30,5; 30/2=15; 15/2=7,5; 7/2= 3,5; 3/2=1,5 (1111011)0.456*2=0.912; 0,912*2=1,824; 0,824*2=1,648; 0,648*2=1,296; 0,296*2=0,592; 0,592*2=1,184; 0,184*2=0,368; 0,368*2=0,736; (0,736*2=1,472; 0,472*2=0,944; 0,944*2=1,888)So 123,456_10=〖01111011.01110100〗_2)123/16= 7,6875 ; 0,6875*16=11 ; 7/16 is less than one, then hex is 7B0,456*16= 7,296 ; 0,296*16=4,736; 0,736*16=11,776; 0,776*16=12,416; 0,416*16=6,656; 0,656*16=10,496; 0,496*16=7,936; 0,936*16=14,976; 0,976*16=15,616; 0,616*16=9,856; 0,856*16=13,696; 0,696*16=11,136; 0,136*16=2,176; 2,176*16=2,816; 0,816*16=13,056Hex is 7B.74BC6A7EF9DB22Dc) 123,456/5=24,6912/5=4,93824/5=0,987648 0,987648*5=4,93824; 0,93824*5=4,6912; 0,6912*5=3,456; 0,456*5=2,28; 0,28*5=1,4; 0,4*5=2; 0*5=0base-5 is 〖443,212〗_5d)BCD is 〖0001 0010 0011.0100 0101 0110〗_2a) Unsigned 16-bit binary is 0000000001101011. Hexadecimal is 6Bb) Unsigned 16-bit binary is 0000000010110101. Hexadecimal is B5
Sarnased õppematerjalid
14
pdf
Mikrokontrollerid ja robootika homework 1
Mictrocontroller Week 03
Numbering systems
1. Convert the decimal number 123.456 to the following formats, taking whole numbers and
fractions into account. Show calculations.
a) Binary
Fractional part : Reading direction Integral part: Reading direction
0,456 x 2 = 0,912 0 123 / 2 = 61 1
0,912 x 2 = 1,812 1 61 / 2 = 30 1
0,812 x2 = 1,624 1 30 / 2 = 15 0
0,624 x 2 = 1,248 1 15 / 2 = 7 1
0,248 x 2 = 0,496 0 7/2=3 1
0,496 x 2 = 0,992 1 3/2=1 1
0 1 1
0 0
So 123.45610 = 0111 1011.0111 01002
b) Hexadecimal
Fractional part :
Mikrokontrollerid ja robootika
3
docx
Homework 1 in Microcontrollers and practical robotics
Homework 1 in Microcontrollers and practical robotics
1)
a)
0
123.456 - 64 = 59.456 1
59.456 - 32 = 27.456 1
27.456 - 16 = 11.456 1
11.456 - 8 = 3.456 1
3.456 - 4 = 0
3.456 - 2 = 1.456 1
1
0.456 * 2 = 0.912 0
0.912 * 2 = 1.824 1
0.824 * 2 = 1.642 1
0.642 * 2 = 1.284 1
0.284 * 2 = 0.568 0
0.568 * 2 = 1.136 1
0.136 * 2 = 0.272 0
0,544 * 2 = 0,544 0
b)1111011.01110100 to hex
0111 => 7
1011 => 11
0111 => 7
0100 => 4
and so on..
answer is: 7B.74
c)
123.456 to base-5
100 = 400
20 = 40
3=3
400 + 40 + 3 = 443
5^-1 = 0,2
5^-2 = 0,04
5^-3 = 0,008
0,456/0,2 = 2
0,056/0,04 = 1,4
0,4/0,2 = 2
Final answer 443.212
d)
1 = 0001
2 = 0010
3 = 0011
4 = 0100
5 = 0101
6 = 0110
0001 0010 0011.0100 0101 0110
2)
a)
16bit equivalent is a) 0000000001101011
the answer is 006B
1011 is in dec 11 and in hex B
0110 is in dec 6 and in hex also 6
b)
16bit equivalent is b) 0000000
Mikrokontrollerid ja praktiline robootika
Kommentaarid (0)
Kõik kommentaarid