0% found this document useful (0 votes)
3 views3 pages

Microcontroller Assignment Answers

The document outlines the structure and functionality of the Interrupt Enable (IE) and Interrupt Priority (IP) registers in microcontroller programming, detailing how to manage interrupt priorities and handle multiple interrupts. It includes programming examples for timer interrupts, serial communication, and interfacing various hardware components like motors and LCDs. Additionally, it provides a brief overview of the interrupt execution process and the interrupt vector table.

Uploaded by

Prajwal K R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views3 pages

Microcontroller Assignment Answers

The document outlines the structure and functionality of the Interrupt Enable (IE) and Interrupt Priority (IP) registers in microcontroller programming, detailing how to manage interrupt priorities and handle multiple interrupts. It includes programming examples for timer interrupts, serial communication, and interfacing various hardware components like motors and LCDs. Additionally, it provides a brief overview of the interrupt execution process and the interrupt vector table.

Uploaded by

Prajwal K R
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

Structure of Interrupt Priority and Interrupt Enable Register

IE (Interrupt Enable) Register (A8H): EA - ET2 ES ET1 EX1 ET0 EX0

IP (Interrupt Priority) Register (B8H): - - PT2 PS PT1 PX1 PT0 PX0

2. Changing Interrupt Priority Using IP Register & Default Priorities

Set bits in IP register. Default priority order: EX0 > T0 > EX1 > T1 > Serial.

3. Bit Contents of IE Register

EA ET2 ES ET1 EX1 ET0 EX0 - controls enable/disable of interrupts.

4. Programming Timer Interrupts

1. Setup TMOD, 2. Load TH/TL, 3. Enable IE, 4. Start timer (TRx), 5. ISR with RETI.

5. Programming Serial Communication Interrupts

Enable ES in IE. Set SCON, baud rate via timer. ISR for RI/TI.

6. Steps in Executing an Interrupt

1. Finish instruction, 2. Save PC, 3. Jump to vector, 4. ISR, 5. RETI, 6. Resume.

7. Interrupt Control in 8051

Controlled via IE and IP. Flags (TF, RI, etc.) trigger ISRs. Supports nesting.

8. Handling Multiple Interrupts

Priority via IP. High-priority interrupts can interrupt low-priority ones.

9. Interrupt Vector Table

EX0 - 0003H, T0 - 000BH, EX1 - 0013H, T1 - 001BH, Serial - 0023H.


10. 1kHz Square Wave C Code (Timer0, Mode2)

#include <reg51.h>

sbit out = P1^2;

void timer0_ISR(void) interrupt 1 {

TH0 = 0x9C; out = ~out;

void main() {

TMOD = 0x02; TH0 = 0x9C; IE = 0x82; TR0 = 1;

while(1); }

12. Stepper Motor Interfacing (Assembly)

P2 connected to stepper via driver.

MOV P2,#09H -> ACALL DELAY -> ... SJMP START.

13. DC Motor C Code

#include <reg51.h>

sbit motor = P2^0;

void delay();

void main() {motor=1; delay(); motor=0; delay();}

14. LCD Interfacing (Assembly)

LCD on P2, RS/RW/EN on P3.0-2. Use MOV + ACALL CMD/DISP subroutines.

15. ADC0804 Interfacing (Assembly)

ALE/P3.3, Start/P3.2, INTR/P3.5, OE/P3.4. MOV A,P1 after INTR low.

16. 'HELLO WORLD' on LCD (C)


RS=1 for data, RS=0 for cmd. Loop through chars of msg[] = "HELLO WORLD".

17. DAC Interfacing (Assembly)

P1 -> DAC. Loop to increment and write A to P1 for ramp.

18. DAC Staircase Waveform (C)

#include <reg51.h>

unsigned char val;

for(val=0;val<255;val++){P1=val; delay();}

You might also like