Free Essay

Et2640

In:

Submitted By jeffb3571
Words 477
Pages 2
-------------------------------------------------
Chapter 2
1. 16
2. 8
3. 8
6. A = 15H + 13H = 28H (HEX) A = 0001_0101B + 0001_0011B = 0010_1000B (BINARY)
7. A and D
11. Low; high
12. Assembly Language uses less memory space then C and files are generally shorter.
13. Compiler
14. true
15. lst file
23. (a) MOV A, #55H - 2 bytes (b) MOV R3, #3 2 bytes (c) INC R2- 1 byte
(d) ADD A, #0 -2 bytes (e) MOV A, R1 -1 byte (f) MOV R3, A -1 byte
(g) ADD A, R2 -1 byte
37. (a) MOV A, #54H , ADD A, #0C4h CY=1
(b) MOV A, #00, ADD A, #0FFh CY=0
(c) MOV A, #250, ADD A, #05 CY=0

38. Add 25H and 70H and find the contents of the AC, CY, and P flags.
25h
70h
95h

AC=0
CY=0
P=0
42. 8 bits
43. bank 0
48. MOV SP, #52H stack starts at MOV A, #04 move 4 into acc MOV R0, #05H move value to r0 ADD A, R0 add and store to acc PUSH 0E0H push the value of acc.on the stack
PUSH 0 push value of r0 on the stack
SET PSW.4 select reg bank 2
POP 10H pop value at r0
0E0H pop the value.of 00
-------------------------------------------------
Chapter 3
4. Short jump; 2 byte
5. long jump; 3 bytes
6. The LJMP instruction is 3-bytes in which the first byte is the opcode, and the second and third bytes represent the 16-bit address of the target location from 0000 to FFFFH. The SJMP is a 2-byte instruction where the first byte is the opcode and the second byte is the address location FFH
7. true
8. false
9. (c)LJMP

10. A short jump is a 2-byte instruction. Why?
The first byte is the opcode (e.g MOV, ADD, etc.) and the second byte is the relative address of the target location. 0-FFH MAX
11. true
14. The loop is executed 200x100 = 20,000 times
17. 3
18. 2
19. 2
20. 3
23. The reason is that the stack keeps track of where the CPU should return after completing the subroutine and must be balanced if PUSH and POP are used.
33. Find the time delay for the following delay subroutine, if the system has an 8051 with frequency of 11.0592 MHz.
DELAY: MOV R3, #200
HERE: NOP
NOP
NOP
DJNZ R3, HERE
-------------------------------------------------
Chapter 4
8. input
11. MOV A, #0FFH ; A = FF hex
MOV P1, A ; make P1 an input port by writing all 1’s to it
BACK: MOV P1,A ; get data from P0 MOV P0,A ; send it to P0 MOV P2,A ; send it to P2 MOV P3, A ; send it to P3 SJMP BACK ; keep doing it
14. 0, because the chip has been reset.

Similar Documents

Free Essay

Et2640 U4A1

...1.Find the CY and AC flags for each of the following: (a)MOV A, #3FHCY=0 No carry out from D7 ADD A, #45HAC=1 carry from D3 to D4 00111111 +01000101 10000100 (b)MOV A, #99HCY=0 No carry out from D7 ADD A, #58HAC=1 carry from D3 to D4 10011001 +01011000 11110001 (c)MOV A, #0FFHCY=1 SETB CAC=0 ADDC A, #00 SETB C-> CY=1 11111111 +CY 1 100000000 +00000000 100000000 (d)MOV A, #OFFHCY=1 ADD A, #1AC=1 11111111 + 1 100000000 (e)MOV A, #OFEHCY=1 SETB CAC=1 ADDC A, #01 11111110 + 1 11111111 + 1 100000000 (f)CLR CCY=1 MOV A, #0FFHAC=1 ADDC A, #01 ADDC A, #0 11111111 +00000001 100000000 +00000000 100000000 2. Write a program to add all the digits of your ID number and save the result in R3. The result must be in BCD. 3. Write a program to add the following numbers and save the result in R2, R3. The data is stored in on-chip ROM. ORG 250H MYDATA: DB 53, 94, 56, 92, 74, 65, 43, 23, 83 4. Modify Problem 3 to make the result in BCD. 6. State the steps that the SUBB instruction will go through for each of the following: 1. Take the 2’s complement of the subtrahend 2. Add it to the minuend 3. Invert the carry (a) 23H-12H 23H -> 00100011 00100011 12H -> 00010010 – 2’s complement+11101110 100010001 Step 3: CY=1 -> CF=0 Positive number 11H (b) 43H-53H 43H -> 01000011 01000011 53H -> 01010011 – 2’s complement+10101101  11110000 Step 3: CY=0 -> CF=1 Negative number -F0H (c) 99-99 99 -> 10011001 10011001 99 ->...

Words: 547 - Pages: 3

Free Essay

Co2520

...Keypad System By: Julian Garcia and Christian White ET2640 Microcontrollers and Microprocessors Mr. Wysuph List of Components I. Breadboard II. 8051 microcontroller III. 4x4 Hex keypad IV. 7 – segment display V. Keil program software VI. 5 volt power supply VII. 330 ohm resistor pack VIII. 1 resistor (8.2K ohm) Progress Update Although our circuit is not built, we have made progress. We have to order a part in order for the project to work. We have to order the 4x4 hex keypad. Once the keypad arrives, we can wire it to our breadboard or the trainer. In order for this project to work, we must make sure that our circuit chips have power (VCC) and are grounded. After that is done, we will take our 33pF capacitors and connect them to our 11.0592MHz oscillator, which is connected to XTAL1 and XTAL2 on the 8051 trainer. We will then tie R1 – R4 and C1 – C4 on our hex keypad to ports 1.0 through 1.7 together on the 8051. Ports 0.0 – 0.7 on the 8051 will have a 330 ohm resistor pack connected to the 7 segment display. We will then have our 10uF capacitor tied together with the 8.2k ohm resistor, which should be connected to our reset. Test Plan To troubleshoot the circuit, we first must know how it is supposed to work. If the keypad is not working, we must check all connections and we can use a logic probe to see if we are getting an output at certain pins. We can also use the logic probe if our 7 – segment display is not lighting up or not...

Words: 310 - Pages: 2

Free Essay

Student

...ET2640 Microprocessors and Microcontrollers Exercise 2.1 Muhammad Abdul Hafiz Answers of questions: 1. It is an ADD operation : 15H+13H = 28H , this result is kept in A 2. Sure, Assembly Language is more efficient in terms of code generation. 3. A compiler produces object code, which is an “obj” file. The assembler will produce an object file and a list file. 4. The List file provides a listing of error. Programming errors fall into two categories. Simple typing/syntax error will be flagged by the TExaS assembler as an error when the assembler tries to translate source code into machine code. The more difficult programming errors to find and remove are functional bugs that can be identified during execution, when the program does not perform as expected. Error messages are meant to be self-explanatory. 5. MOV A,#55H ADD A,#55H ADD A,#55H ADD A,#55H ADD A,#55H 6. The size of stack pointer in 8051 is 8 bit. 7. When 8051 is power up it use register bank 0. 8. Line program | Stack | Stack pointer | ORG 0 | | | MOV R0,#66H | 00 | 07 | MOV R3,#7H | 00 | 07 | MOV R7,#5DH | 00 | 07 | PUSH 0 | 66 | 08 | PUSH 3 | 7F | 09 | PUSH 7 | 5D | 0A | CLR A | 5D | 0A | MOV R3, A | 5D | OA | MOV R7, A | 5D | 0A | OP 3 | | | POP 7 | 5D | 09 | POP 0 | 66 | | 9. The times of loop is: 100x200=20,000 times. 10. The reason is that the stack keeps track of where the CPU should return after completing the subroutine...

Words: 348 - Pages: 2