Académique Documents
Professionnel Documents
Culture Documents
to accompany
Prentice Hall
Boston Columbus Indianapolis New York San Francisco Upper Saddle River
Amsterdam Cape Town Dubai London Madrid Milan Munich Paris Montreal Toronto
Delhi Mexico City Sao Paulo Sydney Hong Kong Seoul Singapore Taipei Tokyo
___________________________________________________________________________________________
Copyright 2009 Pearson Education, Inc., publishing as Prentice Hall, Upper Saddle River, New Jersey and
Columbus, Ohio. All rights reserved. Manufactured in the United States of America. This publication is protected
by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in
a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or
likewise. To obtain permission(s) to use material from this work, please submit a written request to Pearson
Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey.
Many of the designations by manufacturers and seller to distinguish their products are claimed as trademarks.
Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations
have been printed in initial caps or all caps.
10 9 8 7 6 5 4 3 2 1
ISBN-13: 978-0-13-504837-5
ISBN-10: 0-13-504837-0
CHAPTER 0: INTRODUCTION TO COMPUTING
1.
(a) 12 10 = 1100 2
(b) 123 10 = 0111 1011 2
(c) 63 10 = 0011 1111 2
(d) 128 10 = 1000 0000 2
(e) 1000 10 = 0011 1110 1000 2
2.
(a) 100100 2 = 36 10
(b) 1000001 2 = 65 10
(c) 11101 2 = 29 10
(d) 1010 2 = 10 10
(e) 00100010 2 = 34 10
3.
(a) 100100 2 = 24 16
(b) 1000001 2 = 41 16
(c) 11101 2 = 1D 16
(d) 1010 2 = 0A 16
(e) 00100010 2 = 22 16
4.
(a) 2B9 16 = 0010 1011 1001 2 , 697 10
(b) F44 16 = 1111 0100 0100 2 , 3908 10
(c) 912 16 = 1001 0001 0010 2 , 2322 10
(d) 2B 16 = 0010 1011 2 , 43 10
(e) FFFF 16 = 1111 1111 1111 1111 2 , 65535 10
5.
(a) 12 10 = 0C 16
(b) 123 10 = 7B 16
(c) 63 10 = 3F 16
(d) 128 10 = 80 16
(e) 1000 10 = 3E8 16
6.
(a) 1001010 = 0011 0110
(b) 111001 = 0000 0111
(c) 10000010 = 0111 1110
(d) 111110001 = 0000 1111
7.
(a) 2C+3F = 6B
(b) F34+5D6 = 150A
(c) 20000+12FF = 212FF
(d) FFFF+2222 = 12221
9. (a) Hex: 30, 31, 32 , 33, 34, 35, 36, 37, 38, 39
(b) Binary: 11 0000, 11 0001, 11 0010, 11 0011, 11 0100, 11 0101, 11 0110, 11
0111, 11 1000, 11 1001.
11. A 1
3
B 2
4
6
C 5
12.
A B C Y
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 1
13.
A 1
3
B 2
.
4
6
C 5
14.
A B C Y
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
15.
A B C Y
0 0 0 0
A 1
3 0 0 1 1
B 2
0 1 0 1
4 0 1 1 0
6
C 5 1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
16.
A B C Y
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
17.
A B C Y
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 0
18.
LSB
19.
LSB
20.
CLK D Q
No X NC
Yes 0 0
Yes 1 1
21. (a) 4
(b) 4
(c) 4
(d) 1 048 576, 220
(e) 1024K
(f) 1 073 741 824, 230
(g) 1 048 576 K
(h) 1024M
(i) 8388608, 8192K
22. Disk storage capacity / size of a page = (2*230) / (25*80) = 1 million pages
23. (a) 9FFFFh 10000h = 8FFFFh = 589 824 bytes
(b) 576 kbytes
24. 232 1 = 4 294 967 295
25. (a) FFh, 255
(b) FFFFh, 65535
(c) FFFF FFFFh, 4 294 967 295
(d) FFFF FFFF FFFF FFFFh, 18 446 744 073 709 551 615
26. (a) 216 = 64K
(b) 224 = 16M
(c) 232 = 4096 Mega, 4G
(d) 248 = 256 Tera, 262144 Giga, 268435456 Mega
27. Data bus is bidirectional, address bus is unidirectional (exit CPU).
28. The storage of the chip is measured in Megabits while the Computer memory is
measured in Megabytes.
29. True, the more address lines the more memory locations.
30. True, the memory location size is fixed.
31. True, the more data lines the more memory locations
32. True
33. access time
34. True
35. electrically erasable
36. True
37. DRAM
38. SRAM
39. DRAM and SRAM
40. (c)
41. (c)
42. (a) 32Kx8, 256K (f) 8Kx1, 8K
(b) 8Kx8, 64K (g) 4Kx8, 32K
(c) 4Kx8, 32K (h) 2Kx8, 16K
(d) 8Kx8, 64K (i) 256Kx4, 1M
(e) 4Mx1, 4M (j) 64Kx8, 512K
43. (a) 128K 14 8 (f) 256K 8 4
(b) 256K 15 8 (g) 8M 20 8
(c) 512K 16 8 (h) 16M 11 4
(d) 2M 18 8 (i) 512K 16 8
(e) 512K 16 8
44. 4000h - 7FFFh
45.
A0
A11
A12 1
3
A13 1 2 2 ~CS
46. 8000h - 8FFFh, B000h - BFFFh, E000 - EFFFh
47. A0
A12
8kx8
U?
15
A13 1 Y0N 14 ~CS
A14 2 A Y1N 13
A15 3 B Y2N 12
Vcc 6 C Y3N 11
4 G1 Y4N 10
5 G2AN Y5N 9
G2BN Y6N 7
Y7N
74138
A14
32kx8
U?
15
A15 1 Y0N 14 ~CS
A16 2 A Y1N 13
A17 3 B Y2N 12
Vcc 6 C Y3N 11
4 G1 Y4N 10
5 G2AN Y5N 9
G2BN Y6N 7
Y7N
74138
54. RISC stands for "Reduced Instruction Set Computer". CISC stands for "Complex
(or Complete) Instruction Set Computer".
55. CISC
56. RISC
57. RISC
58. CISC
CHAPTER 1: THE HCS12 MICROCONTROLLERS: HISTORY AND
FEATURES
1. False.
2. True.
3. True.
4. True.
5. CPU, RAM, ROM, EEPROM, I/O, Timer, Serial COM port, ADC.
6. RAM and ROM.
7. Keyboard, mouse, printer.
8. Computing power and compatibility with millions and millions of PCs.
9. PIC 16x Microchip Technology, 8051 - Intel, AVR Atmel, Z8 Zilog,
68HC11 Freescale Semiconductor (Motorola).
10. 8051.
11. Power consumption.
12. The ROM area is where the executable code is stored.
13. Very, in case there is a shortage by one supplier.
14. Suppliers other than the manufacturer of the chip.
15. B is absolutely wrong, 16 bit software can not run on a 8 bit system due to special
instructions and registers. But A can be true (in the case of software
compatibility).
1. 16
2. 8
3. 8
4. FFH
5. necessary
6. The result is 28H, stored in Accumulator A.
7. In (a) and (d) the operand exceeds allowed range. The syntax of (g) is wrong, since
ADDA can have only one operand ( ADDA mybyte , or , ADDA #$50 ).
8. (a), (c) and (d) exceed the allowed range.
9. The result is 44H in accumulator A.
10. The result is FFH in accumulator A.
11. FFH
12. False. There is only one register A and one register B.
13. 64KBytes
14. True
15. False. Registers are part of Register space.
16. True
17. False
18. False. There are also Register Space and unused space.
19. (a) 14 KBytes
(b) 1 KBytes
20. Data RAM is used to store temporary data, and when power goes off its information is
lost. But, we use EEPROM to store nonvolatile data that must remain intact even when
the power is turned off.
21. Yes, some chips have no EEPROM, page 66.
22. No, the HCS12 needs RAM for volatile data.
23. Flash.
24. 32 KBytes.
25. 0000H
26. Registers 000-3FFF, RAM 0800-3FFF, EEPROM 7000-7FFF, Code ROM C000-FFFF
27. 800H
28. LDAA #$30
STAA $805
LDAA #$97
STAA $806
29. LDAA #$55
STAA $300
STAA $301
STAA $302
STAA $303
STAA $304
STAA $305
STAA $306
STAA $307
STAA $308
30. LDAA #5F
STAA PORTB
31. (b) LDAA $30 is Extended mode addressing.
32. (a) Direct, (b) Immediate, (c) Extended, (d) Immediate, (e) Inherent, (f) Inherent
33. (a) 3 Byte, (b) 2 Byte, (c) 3 Byte, (d) 2 Byte, (e) 1 Byte, (f) 1 Byte
34. 0000H
35. Direct Addressing
36. Immediate Addressing
37. Direct Addressing
38. Extended Addressing
39. Invalid
40. 800H 8FFH
41. Registers X and Y
42. True
43. 8 bit
44. C = bit 0, H = bit 5
45. V = bit 1 , N = bit 3
46. The C flag = 1 when there is a carry out from the D7 bit after an 8-bit arithmetic
operation.
47. The H flag = 1 when there is a carry from the D3 to D4 bit after an 8-bit arithmetic
operation.
48. FFH + 1 = 100H, but since register A is only 8-bit the Z and C flags are both = 1.
49. (a) 118H, so C = 1
(b) FFH, so C = 0
(c) 104H, so C = 1
50. LDAA #$55
ADDA #$55
ADDA #$55
STAA $1200
SECTION 2.5: HCS12 DATA FORMAT AND DIRECTIVES