8051_Assembly_Language_Programmin
8051_Assembly_Language_Programmin
After every instruction, the 8051 automatically checks the interrupts. The Interrupt
conditions are checked in the following order from highest priority to lowest priority order.
Whenever External Interrupt 0 and Timer 1 interrupt occur at the same time, the 8051
executes the ISR of External Interrupt 0 first. Then the 8051 returns to the main program,
executes one instruction, and then executes the ISR of Timer 1 interrupt.
Interfacing Circuit :
A typical interfacing circuit of DAC 0800 with 8051 is shown below.
Intel 8051 DAC 0800
P1.0
P1.1
P1.2 Voltage
P1.3 DAC 0800 Amplifier Vo
P1.4
P1.5
P1.6
P1.7
Page | 23
Branch : Electronics & Telecommunication Engineering
Semester 3rd Year / 5th Semester
Microcontroller & Embedded System
Interfacing Circuit :
A typical interfacing circuit of ADC 0808 / 0809 with 8051 is shown below.
P1.0 IN0
P1.1 IN1
P1.2 IN2
P1.3 IN3
P1.4 IN4
P1.5 IN5
P1.6 IN6
P1.7
A IN7
P0.0 B
P0.1 C
P0.2 SC OE EOC
P0.3
P0.4
P0.5
Page | 24
Branch : Electronics & Telecommunication Engineering
Semester 3rd Year / 5th Semester
Microcontroller & Embedded System
PROCEDURE OF A/D CONVERSION :
1. There are 8—input channels for analog signals in the ADC 0808 / 0809. At a time
one channel is selected by decoding signal A B C which is obtained from the pins
P0.0, P0.1 & P0.2 of Port—0.
2. A start conversion pulse ( SC ) is given to ADC from the P0.3 pin and ADC starts
conversion of analog signal into digital signal.
3. When conversion is complete, end of conversion ( EOC ) signal is sent to the 8051
through pin P0.5.
4. Now 8051 sends the output enable signal ( OE ) to ADC and reads the digital data
from ADC and save it into the accumulator register. Thus conversion is completed.
ORG 0000 H
START : MOV P1, #0FF H : Move highest data FF H to the Port 1
MOV R0, #0FF H : Set count value FF H in R0 for ON period.
LOOP1 : DJNZ R0, LOOP1 : Execute loop for duration of ON period.
MOV P1, #00 H : Move lowest data FF H to the Port 1
MOV R1, #0FF H : Set count value FF H in R1 for OFF period.
LOOP2 : DJNZ R1, LOOP2 : Execute loop for duration of OFF period.
SJMP START : Repeat the program for continuous wave.
END : Program Terminated.
The count value in R0 and R1 may be adjusted for variable Duty Cycle and Frequency of
Square Wave.
Page | 25
Branch : Electronics & Telecommunication Engineering
Semester 3rd Year / 5th Semester
Microcontroller & Embedded System
(a) 8 (b) 16
9. When a Timer register is loaded with the value FF00 H, it counts from_____
12. ____ instruction loads the data 45 H into higher byte of Timer 1.
13. The selection for “Timer” or “Counter” is done by ____ bit TMOD register.
14. Timer Interrupt flag TF1 is set when the count rolls over from____ to _____.
Page | 27
Branch : Electronics & Telecommunication Engineering
Semester 3rd Year / 5th Semester
Microcontroller & Embedded System
16. If the crystal frequency is 12 MHz, then the Timer clock frequency will be ___.
22. In Mode 0, Timer 0 or Timer 1 overflows for roll over from ____.
23. In Mode 1, Timer 0 or Timer 1 overflows for roll over from ____.
25. Start bit and Stop bit are used in _____ serial communication.
28. ____ is used as line driver in the connection or RS232 with the 8051.
Page | 28
Branch : Electronics & Telecommunication Engineering
Semester 3rd Year / 5th Semester
Microcontroller & Embedded System
34. What do you mean by half-duplex transmission mode ?
44. The 9th bit in serial communication represents a parity bit. ( True / False ).
47. Serial port Interrupt RI/TI has the lowest priority. ( True / False ).
48. External hardware interrupt 0, INT0 has the lowest priority. ( True / False ).
49. TCON register controls the triggering level of two hardware interrupts. (True/False).
50. Interrupt Enable (IE) register is used to enable/disable the interrupts. (True/False).
52. Starting address of Interrupt Service Subroutine, (ISR) is called Interrupt Vector
Address. ( True / False ).
53. Interrupt Service Subroutine, (ISR) is terminated by _____ instruction.
54. When Serial port interrupt occurs, ______ interrupt flag bit is set.
55. _____ instruction makes the INT0 interrupt negative edge triggered.
Page | 29