100% found this document useful (1 vote)
58 views

pa 3

The document explains the functioning of interrupts in microcontrollers, particularly focusing on the PIC18 series. It details the roles of various registers such as the Peripheral Interrupt Request (PIR) and Peripheral Interrupt Priority (IPR) registers, as well as the Interrupt Control Register (INTCON). Additionally, it covers the configuration of interrupt-related bits and the significance of the Interrupt Vector Table (IVT) and Interrupt Service Routine (ISR) in handling interrupts.

Uploaded by

devidaspawar4378
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
100% found this document useful (1 vote)
58 views

pa 3

The document explains the functioning of interrupts in microcontrollers, particularly focusing on the PIC18 series. It details the roles of various registers such as the Peripheral Interrupt Request (PIR) and Peripheral Interrupt Priority (IPR) registers, as well as the Interrupt Control Register (INTCON). Additionally, it covers the configuration of interrupt-related bits and the significance of the Interrupt Vector Table (IVT) and Interrupt Service Routine (ISR) in handling interrupts.

Uploaded by

devidaspawar4378
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/ 14

The above diagram explains us how microcontroller service the interrupts.

ISR: Interrupt service routine gives the service to all kind of interrupts i.e High and
Low
The microcontroller Port B is responsible to handle the interrupt.
Above pins are sources of interrupts.
MCU: It is Microcontroller UNIT
Note: In both cases i.e Polling and Interrupt the external devices need processing power
from Microcontroller Unit.
In Polling the controller is required for continuously monitoring the status of devices
attached.
In Interrupt the controller is not required for monitoring the status of devices attached.
RBIE Pin:
A "RB port change interrupt" refers to a type of interrupt triggered
when the state of any pin on a microcontroller's Port B changes,
meaning a pin on that port goes from high to low or vice versa, often
used in microcontrollers like PIC microchips where "RB" denotes the
Port B register; essentially, it allows the microcontroller to instantly
react to any change on any pin within that port.

Explain PIR (Peripheral Interrupt Request Register)


IPR (Peripheral Interrupt Priority Register)
In PIC 18 microcontrollers, the PIR (Peripheral Interrupt Request) register and IPR
(Peripheral Interrupt Priority) register are important components
for managing interrupts
1. Peripheral Interrupt Request (PIR) Register:
•The PIR register is a special register used to indicate which peripheral interrupt
requests have occurred.
•Each bit in the PIR register corresponds to a specific peripheral interrupt source.
When an interrupt from a particular peripheral occurs, the corresponding bit in the PIR
register is set to indicate the pending interrupt.
•Software can periodically check the PIR register to determine which peripheral(s)
triggered an interrupt and take appropriate action.
•After the interrupt is serviced, it's important to clear the corresponding bit in the PIR
register to acknowledge the interrupt and allow subsequent interrupts of the same type
to be recognized.
2. Peripheral Interrupt Priority (IPR) Register:
•The IPR register is used to set the priority levels for different peripheral interrupts.
•In PIC 18 microcontrollers, interrupt sources are often grouped into different priority
levels, where interrupts with higher priority levels are serviced before interrupts with
lower priority levels.
•The IPR register allows you to configure the priority level for each peripheral
interrupt source.
•By setting the appropriate bits in the IPR register, you can assign priority levels to
different peripheral interrupts based on your application's requirements.
•When multiple interrupt requests occur simultaneously, the microcontroller's interrupt
controller uses the priority levels configured in the IPR register to determine the order
in which interrupts are serviced
PIC18 Interrupt Structure:
Or
Bit Configuration of INTCON /Interrupt Control Register 1 for various
hardware interrupt operation in PIC
Or
Explain with neat diagram the external hardware interrupts of pic18
microcontroller in detail( ONLY INTCON REGISTER)

GIE: Global Interrupt Enable bit

1-Enables all unmasked interrupts

0-Disables all interrupts

PIE: Peripheral Interrupt Enable bit

1-Enables all unmasked peripheral interrupts

0-Disables all peripheral interrupts

TMR0IE: TMR0 Overflow Interrupt Enable bit

1-Enables the TMR0 interrupt

0-Disables the TMR0 interrupt

INTE: RB0/INT External Interrupt Enable bit

1 = Enables the RB0/INT external interrupt

0 = Disables the RB0/INT external interrupt

RBIE: RB Port Change Interrupt Enable bit

1 = Enables the RB port change interrupt

0 = Disables the RB port change interrupt

TMR0IF: TMR0 Overflow Interrupt Flag bit

1-TMR0 register has overflowed (must be cleared in software)

0-TMR0 register did not overflow


INTF: RB0/INT External Interrupt Flag bit

1 = The RB0/INT external interrupt occurred (must be cleared in software)

0 = The RB0/INT external interrupt did not occur

RBIF: RB Port Change Interrupt Flag bit

1 = At least one of the RB7:RB4 pins changed state

0 = None of the RB7:RB4 pins have changed state

Interrupt Control Register-2 i.e INTCON2


Or
Illustrate the use of following bits of INTCON2 register:
i) INTEDG1
ii) TMR0IP

RBPU: PORTB Pull-up Enable bit (This bit is not used for timers)

In microcontrollers, a Pull-up Enable bit typically refers to a configuration setting in the


microcontroller's register that allows or disables the internal pull-up resistors on specific input
pins. These pull-up resistors are used to ensure that a digital input pin reads a defined logic level
(high) when no active signal is applied to it

1 = PORTB pull-ups are disabled

0 = PORTB pull-ups are enabled by individual port latch values

INTEDG Interrupt Edge Select bit

1 = Interrupt on the rising edge of RB0/INT pin

0 = Interrupt on the falling edge of RB0/INT pin

T0CS: TMR0 Clock Source Select bit

1 = Transition on T0CKI pin

0 = Internal instruction cycle clock (CLKO)

T0SE: TMR0 Source Edge Select bit

1 = Increment on high-to-low transition on T0CKI pin

0 = Increment on low-to-high transition on T0CKI pin

PSA: Prescaler Assignment bit


1 = Prescaler is assigned to the WDT

0 = Prescaler is assigned to the Timer0 module

PS2:PS0: Prescaler Rate Select bits


What are peripheral interrupts, IVT and ISR?
In a PIC 18 microcontroller, peripheral interrupts, IVT (Interrupt Vector Table),
and ISR (Interrupt Service Routine) are key components used for handling
interrupt-driven events. Here's a breakdown of each concept:
IVT (Interrupt Vector Table):
The Interrupt Vector Table (IVT) is a special table in memory that contains the
addresses of the interrupt service routines (ISRs) for each interrupt source.
When an interrupt occurs, the microcontroller uses the IVT to jump to the
corresponding ISR. The IVT maps each interrupt source (like timers, UART, or
external interrupts) to a specific memory address where the ISR for that
interrupt resides.
In the case of the PIC 18, the IVT is generally located at a fixed starting address
in memory (usually at 0x0004 for the first interrupt). When an interrupt
happens, the PIC 18 looks up the vector (address) in the IVT for that particular
interrupt source and jumps to that address to execute the corresponding ISR.
3. ISR (Interrupt Service Routine):
An Interrupt Service Routine (ISR) is a special function in the program that is
executed in response to an interrupt. When an interrupt occurs, the
microcontroller halts the current program execution, saves the state of the CPU
(context saving), and jumps to the ISR. The ISR contains the code that handles
the interrupt and responds to the event that caused the interrupt.
After the ISR is executed, the microcontroller restores the previous CPU state
and resumes the interrupted program.

Draw an interfacing diagram for 16X2 LCD with PIC18 F microcontroller


and explain its working.
OR
Draw and explain the interfacing of relay and buzzer with PIC 18Fxxx
microcontroller
Explain function of following LCD pins
RS, RW ,EN
RS (Pin 4):
Function: Register Select. This pin selects whether the data being sent to the LCD is
command or data.
When RS = 0, the data is interpreted as a command.
When RS = 1, the data is interpreted as display data.
RW (Pin 5):
Function: Read/Write. This pin determines the direction of data transfer.
When RW = 0, the LCD is in write mode (data is sent to the display).
When RW = 1, the LCD is in read mode (data is read from the display, though this
is rarely used in most applications).
EN (Pin 6):
Function: Enable. This pin is used to latch data into the LCD. A high-to-low
pulse on this pin tells the LCD to read the data present on the data pins (D0 to
D7).

You might also like