LAB 1 Page 1
© Copyright David Elmo Ross 2019
NAME: _______________________________ STUDENT ID #: ______________________________
LAB 1: NUMBER CONVERSIONS
LAB SECTION: A B C D E F G H I J K L M N O P
OBJECTIVES:
1. To convert a HCS08 PROGRAM between HEX, BINARY, and OCTAL Number Systems.
2. To convert between ASCII and HEX
3. To convert UNSIGNED Numbers from DECIMAL, HEX, BINARY, OCTAL, and BCD.
4. To convert SIGNED Numbers from DECIMAL, HEX, BINARY, OCTAL.
5. To figure out N, Z, V, C Conditions after ADDing/SUBTRACTing.
Procedure:
1. Referring to the Section on BINARY to OCTAL, and BINARY to HEX conversions in the
Introductory Notes:
(A) Circle any of the following BINARY HCS08 to OCTAL and HEX conversions that are
NOT correct then write beside it the CORRECT number.
BINARY PROGRAM OCTAL PROGRAM HEX PROGRAM
1 0 1 0 0 1 1 0 1 4 6 A 6
1 0 1 0 1 1 0 0 2 5 4 A C
1 0 1 0 1 0 1 1 2 5 3 A D
0 0 1 1 1 1 0 1 0 7 5 3 D
1 0 1 1 0 1 1 1 2 6 7 B 7
1 0 0 0 0 0 0 0 2 0 0 8 0
0 0 1 0 0 0 0 0 0 2 0 2 0
1 1 1 1 1 1 1 0 3 7 6 F E
(B) Circle any of the following OCTAL HCS12 to BINARY and HEX conversions that are
NOT correct then write beside it the CORRECT number.
BINARY PROGRAM OCTAL PROGRAM HEX PROGRAM
1 0 1 0 0 1 1 0 2 4 6 A 6
0 1 1 0 0 1 0 1 1 2 5 5 5
1 0 1 0 0 0 0 0 2 4 0 A 0
0 1 1 1 1 1 1 1 1 7 7 7 F
1 0 1 1 0 1 1 1 2 6 7 D 7
1 0 0 0 0 1 0 1 2 0 5 8 5
0 0 1 0 0 0 0 0 0 4 0 2 0
1 1 1 1 1 1 1 0 3 7 6 F D
LAB 1 Page 2
© Copyright David Elmo Ross 2019
(C) Circle any of the following HEX HCS08 to BINARY and OCTAL that are NOT correct then write
beside it the CORRECT number.
BINARY PROGRAM OCTAL PROGRAM HEX PROGRAM
1 0 1 0 0 1 1 0 2 4 6 A6
0 1 1 0 1 1 0 1 1 5 4 6C
1 0 1 0 0 1 0 0 2 4 4 A4
1 0 0 1 1 1 1 0 2 3 6 9E
1 1 0 1 0 1 1 1 2 6 3 B7
1 0 0 1 0 0 1 0 1 4 2 92
0 0 1 0 0 0 0 0 0 4 0 20
1 1 1 1 1 1 0 1 3 7 6 FE
2. (A) Using the ASCII chart in the INTRODUCTORY NOTES, convert the following HEX characters to
their equivalent ASCII characters to form a message:
59 6F 75 20 63 61 6E 20 64 6F 20 69 74 21
(B) Using the same ASCII chart , convert the following ASCII characters to their HEX equivalents:
A r e w e h a v i n g f u n ?
3. For each of the following HEX Calculations, CIRCLE the ANSWER and VALUES for N,Z,V and C
that are INCORRECT and write the correct answer beside them.
(A) A E (B) 6 A (C) 0 0 (D) 9 C (E) 9 C
+ C D - F E - 7 E + 6 4 - 6 4
-------- ------- ------- ------- -------
7 B 7 B 8 2 0 0 3 8
N = 1 N = 0 N = 1 N = 0 N = 0
Z = 0 Z = 0 Z = 0 Z = 1 Z = 0
V = 1 V = 1 V = 0 V = 1 V = 1
C = 1 C = 1 C = 1 C = 1 C = 0
LAB 1 Page 3
© Copyright David Elmo Ross 2019
4. For each of the following BINARY Calculations, CIRCLE the ANSWER and VALUES for N,Z,V, & C
that are INCORRECT and write the correct answer under or beside them.
(A) 0 1 0 1 1 0 1 1 (B) 1 0 0 1 1 0 1 0 (C) 1 1 0 1 1 0 1 0
- 1 1 1 0 1 0 1 0 + 1 1 1 1 0 1 1 0 - 0 1 1 0 1 1 0 1
------------------ ------------------ -------------------
0 1 1 1 0 0 0 1 1 0 0 1 0 0 0 0 0 1 1 0 1 1 0 1
N = 0 N = 1 N = 0
Z = 0 Z = 0 Z = 0
V = 0 V = 0 V = 1
C = 1 C = 0 C = 0
5. CIRCLE the following 8 Bit UNSIGNED CONVERSIONS that are INCORRECT:
DECIMAL HEX BINARY OCTAL BCD
1 2 2 7 A 0 1 1 1 1 0 1 0 1 7 2 0 0 0 1 0 0 1 0 0 0 1 0
1 6 9 A 9 1 0 1 0 1 0 0 1 2 5 1 0 0 1 0 0 1 0 1 0 0 0 1
1 0 2 3 6 1 1 0 0 1 1 0 1 4 6 0 0 0 1 0 1 0 0 0 1 1 0
1 5 7 9 D 1 0 0 1 1 1 0 1 2 3 5 0 0 0 1 0 1 0 1 0 1 1 1
1 9 8 C 6 1 1 1 0 0 1 1 0 3 0 6 0 0 0 1 1 0 0 1 1 0 0 0
LAB 1 Page 4
© Copyright David Elmo Ross 2019
6. CIRCLE the following 8 Bit SIGNED Conversions that are INCORRECT:
DECIMAL HEX BINARY OCTAL
- 49 CF 1 1 0 0 1 1 1 1 3 1 7
- 19 ED 1 1 1 0 1 0 1 1 3 5 7
- 91 A5 1010 0101 2 4 5
- 1 7 2 5 4 0 1 0 1 0 1 0 0 124
7. Circle BIT 6: 1 0 1 1 0 1 1 1
8. Using 8 Bit SIGNED numbers, is the number in question 7 positive or negative?
9. Convert the following DECIMAL NUMBERS to 16 bit HEX (without a calculator!).
Show your work below:
(A) 6 0 0 0 0
(B) - 2 5 0 0 0
10. (A) Is the 16 bit number in 9 (A) above SIGNED or UNSIGNED?
(B) EXPLAIN.
LAB 1 Page 5
© Copyright David Elmo Ross 2019
11. (A) What is the symbol in C for a bitwise AND operation? _______
What is the symbol in C for a bitwise OR operation? _______
What is the symbol in C for a bitwise XOR (exclusive or) operation? _______
What is the symbol in C for a bitwise NOT operation? _______
(B) The following table contains a value for number and a value for mask. The AND, OR, and XOR
operations are performed on number and mask. In addition the NOT operation is performed on
number. For the values given, CIRCLE any values that are INCORRECT.
number number mask mask AND AND OR OR XOR XOR NOT NOT
(HEX) (Binary) (HEX) (Binary) (HEX) (Binary) (HEX) (Binary) (HEX) (Binary) (HEX) (Binary)
0xAB 10101011 0x0F 00001111 0x0B 00001011 0xAF 10101111 0xA4 10100100 0x54 01010100
0XCD 11001101 0XF0 11110000 0xC0 11000000 0xFD 11111101 0x3D 00111101 0x32 00110010
0X4C 01001100 0XAA 10101010 0x0A 00001000 0xEE 11101110 0xA6 11100110 0xB3 10110011
0X5E 01011110 0XC7 11000111 0x46 01000110 0xDF 11011111 0x99 10011001 0xA1 10100001
0X75 01110101 0X3A 00111010 0x30 00110000 0x7F 01111111 0x4F 01001111 0x8A 100001010
学霸联盟