Vous êtes sur la page 1sur 5

Electronics System Design

Tutorial:1
1. State differences and similarities between 8031,8051,8052 and 8751 chips.
2. Fill in the blanks:
(i) In the 8051, the PC size is _________bits wide.
(ii) The first opcode of an 8051 program starts at ________ROM location.
(iii) The size of SP register in 8051 is ____bits wide.
(iv) With each PUSH instruction the SP register ___________by 1.
(v) On power up, the 8051 uses the RAM location______ as the first location of
the stack.
(vi) On power up, the 8051 uses RAM locations ___ to ___ for registers R0-R7 of
Bank 0.
(vii) ________ is 16 bit register which has no byte address.
(viii) The microcontroller has 7FFF H as the last address of its last location of on-
chip ROM. The size of on-chip ROM is ______.
(ix) If EA’ pin is connected to ground the maximum size of external ROM
connected is______.
(x) In accessing stack_________addressing mode is used.
3. Which of the following instructions are illegal:
(i) MOV R3,#500 (iv) ADD R3,A
(ii) MOV R1,#50 (v) ADD A,#255H
(iii) MOV A,#255H
4. Assuming the use of register bank 0 find at what RAM locations each of the
following lines stored data.
(i) MOV R4,#32H (iii) MOV R7,#3FH
(ii) MOV R0,#12H (iv) MOV R5,#55H
5. Does the register A has BCD data after the following instruction is executed?
MOV A,#54
6. State difference and importance between CY and OV flag.
7. Identify the addressing modes: (a) MOV B,#24H (b) MOV A,50H (c) MOV
R2,07H (d) MOV A,@R0 (e) MOV B,A
8. Give another instruction for CLR C.
9. Explain difference between MOV 80H,#99H and MOV @R0,99H if R0=80H.
10. Show the contents of stack and stack pointer after each instruction:

M0V SP,#70H
MOV R5,#66H
MOV R2,#7FH
MOV R7,#5DH
PUSH 5
PUSH 2
PUSH 7
CLR A
MOV R2,A
MOV R7,A
POP 7
POP 2
POP 5

(N.N. Parmar)
Electronics System Design
Tutorial:2
1. Fill in the blanks:

(i) The minimum no. of machine cycles required to execute an 8051 instruction
is____.
(ii) The machine cycle for 12 MHz clock is ______.
(iii) In the 8051, looping action with the instruction DJNZ Rx, rel. address is
limited to __________iterations.
(iv) The ACALL target address is limited to _______bytes from the present PC.
2. Find the time delay for the following programs if clock frequency is 16MHz.

(i) DELAY: MOV R3,#200 (ii) DELAY:MOV R5,#100


HERE: NOP BACK: MOV R2,#200
NOP AGAIN: MOV R3,#250
NOP HERE: NOP
DJNZ R3, HERE NOP
RET DJNZ R3,HERE
DJNZ R2, AGAIN
DJNZ R5,BACK
RET

3. Which are illegal? Why? (a) MUL A, R1 (b) ADD R1,R2(c) DIV A,R1(d) RLC R1
(e) CJNE R4,#67 (f) SETB P1 (g) SETB P1.3 (h) CLR 87H (i) CLR PSW.3 (j) CLR
ACC.5 (k) CLR 90H
4. Find CY flag after following instructions executed:
(i) CLR A (ii) CLR C
ADD A, #FFH JC OVER
JNC OVER SETB C
CPL C OVER:……
OVER: ………

5. Indicate status of carry flag after following instructions executed and indicate
whether or not jump happens in each case;
(a) MOV A, #25H (b) MOV A,#AAH (c) MOV R1,#0
CJNE A, #44H,OVER ANL A,#55H CJNE R1,#0,NEXT
CJNE A,#00H,NEXT
6. After power up, show how to select bank 2 with a single instruction.
Electronics System Design
Tutorial:3

1. Write a program to add 8979FAH to 34BC48H and save the result in RAM
locations starting at 60H.
2. Write a program with three subroutines to (a) transfer 10 data bytes from ROM
locations 0250H onwards to RAM locations 30H onwards (b) add them and save
the result in 70H and 71H (c) find the average and place them in R7 of bank 3.
3. Write a program to convert a series of five packed BCD data stored in ROM
starting with 0300H and place ASCII codes in RAM starting at 40H onwards.
4. Find the checksum byte for the following ASCII message: “Hello”.
5. Write a program to save registers A and B on R3 and R5 of bank2, respectively.
6. Show how you would check whether OV flag is low.
7. Write instruction to save the CY flag in bit location 4.
8. Write instruction to see whether D0 and D1 bits are high. If so, then divide register
A by 4.
9. Write a program to see whether A is divisible by 8. If so, the set CY flag; otherwise
reset it.
10. Write a program to push R0,R1 and R3 of bank1 onto the stack and pop them back
into R5,R6 and R7 of bank 3.
Electronics System Design
Tutorial:4
Date: 08-10-2009.
1. On power up all ports of 8051 are configured as_______ports.
2. Which 8051 port requires pull up resistors?
3. Which 8051 port has no alternate function?
4. What is the function of PSEN’ pin?
5. Which pins are used to interface 8051 with external RAM?
6. Draw the power on reset circuit for 8051.
7. Which pin is used to inform the 8051 that the on-chip ROM contains the program?
8. Write a program to get 8 bit data from P1 and send it to P0, P2 and P3.
9. Write instructions to get status of P2.7 and put it on P2.0.
10. Write a program to toggle P1.3, P1.7 and P2.5 continuously without disturbing the
rest of the bits.
11. Write a program to find y=x*x+2*x+5 and x is between 0 and 9, get x from P0 and
give y to P1.
12. Write a program to generate square wave with 75% duty cycle on bit P1.5.
13. Assume that the lower four bits of P1 are connected to four switches. Write a
program to send corresponding ASCII code to port 2.
Electronics System Design
Tutorial:5

1. Fill in the blanks


i. To get 2ms delay, _______number should loaded into TH-TL registers
using mode1 if clock frequency is 11.0592MHz.
ii. To get 100µs delay, _________ number should be loaded into TH
register using mode2 if clock frequency is 11.0592MHz.
iii. _________provides the clock pulse to timers if C/T=0 and
_________provides the clock pulse to timers if C/T=1.
iv. Timer___ is used to set the baud rate in mode__.
v. To transfer a data byte serially, it must be placed in register______.
vi. TI flag is raised when__________.
vii. To put the entire ISR in the interrupt vector table, it must be no more
than ____ bytes.
2. Indicate the size of timer for mode0, 1 and 2 and also indicate roll over value.
3. With XTAL=11.0592MHz, 12MHz, 16MHz and 20MHz, indicate when TF0 flag is
raised for the following program.
MOV TMOD,#01H
MOV TL0,#12H
MOV TH0,#1CH
SETB TR045
4. With XTAL=12MHz, calculate the highest and lowest frequency of square wave
generated by timer in mode1 and 2.
5. Assuming that we are transmitting the ASCII letter ‘E’ with no parity bit and one
stop bit, show the sequence of bits transferred serially. Calculate the time it takes to
transfer 10,000 characters if we use 9600bps. What % of time is wasted due to
overhead?
6. What is difference between the RET and RETI instructions? Explain why we can
not use RET instead of RETI as the last instruction of an ISR?
7. Assume that the IP register contains all 0s. Explain what happens if both INT0 and
INT1 are activated at the same time.
8. What happens if a higher priority interrupt is activated while the 8051 is serving a
lower priority interrupt?

Note: Following topics are included in theory(Not covered in class); but covered in
practical:
(i) Analog multiplier, square and square root circuits
(ii) Digital technique for waveform generation using analog multiplexer
(iii) Waveform generation using DAC and microcontroller 8051

Vous aimerez peut-être aussi