PIC microcontroller interrupt module introduction

Single chip microcomputer STM32L151CCU6
L0504-Murata muRata common mode inductor 90Ω 150mA

Introduction to the PIC Microcontroller Interrupt Module:

The PIC16F87X family of microcontrollers supports up to 14 different interrupt sources. The INTCON register is responsible for tracking each interrupt request, enabling or disabling individual interrupts, and managing the global interrupt enable bit. This allows the microcontroller to handle multiple interrupt events efficiently.

Some of the key interrupts available in the PIC16F87X include: Timer0 Overflow Interrupt (TOIF), External Interrupt (INTF), Port B Change Interrupt (RBIF), Parallel Slave Port Interrupt (PSPIF), A/D Conversion Interrupt, USART Asynchronous Receive Interrupt (RCIF), USART Asynchronous Transmit Interrupt (TXIF), Synchronous Serial Port Interrupt (SSPIF), CCP1 Interrupt (CCP1IF), Timer2 Interrupt (TMR2IF), Timer1 Interrupt, CCP2 Interrupt, EEPROM Write Interrupt (EEIF), and Bus Collision Interrupt (BCLIF). Each of these interrupts can be individually configured and managed based on application needs.

Interrupts are handled in a polling mode. When an interrupt occurs, the CPU checks the corresponding flag bits to determine which interrupt has been triggered and then executes the appropriate interrupt service routine (ISR). This ensures that the system responds accurately and efficiently to external events.

The RB0/INT external interrupt follows the same principle as other interrupts in the PIC16F87X. It generates an interrupt flag (INTF) when a valid edge is detected on the pin. The type of edge—rising or falling—is determined by the INTEDG bit in the OPTION_REG register. Once the interrupt is triggered, the CPU processes it, and the flag must be cleared manually in the ISR before re-enabling interrupts to avoid repeated triggering.

If the INTE bit is set before entering Sleep mode, the external interrupt can wake up the CPU from sleep. The GIE bit controls whether the CPU will respond to the interrupt vector upon waking up. This feature is particularly useful in low-power applications where the microcontroller must remain in a power-saving state until an event occurs.

The TMR0 overflow interrupt is automatically triggered when the timer reaches its maximum value (FFH) and rolls over to 00H. This sets the TOIF flag, which can be enabled or disabled using the TOIE bit. This functionality is essential for time-based operations such as periodic task execution or timing control.

When handling interrupts on RB7 and RB4 pins, there are two types of signals: "short pulse" and "wide pulse." In the case of a short pulse, the pin returns to its original state before the CPU finishes processing the interrupt, preventing false triggers. However, if the signal is a wide pulse and the pin returns to its original state after the CPU has started processing, it may cause a false interrupt. This scenario requires careful handling in the code to avoid unnecessary interruptions.

The Port B change interrupt (RBIF) is triggered when any of the pins on Port B (from D7 to D4) changes state. This interrupt can be controlled via the RBIE bit, allowing developers to enable or disable this specific interrupt source as needed.

Understanding and properly configuring the interrupt module is crucial for developing reliable and efficient embedded systems. By mastering the use of flags, masks, and interrupt service routines, developers can create responsive and robust applications using the PIC16F87X microcontroller.

Automotive Switch

Automotive Switches

Automotive Switches,ie, Car Switches are gradually enjoy a lager popularity in the Automobile industry , including Automotive Push Button Switches, Automotive Toggle Switches, Automotive Rocker Switches, Automotive Rotary Switches, Automotive Battery Switches,Automotive Plunger Push Button Siwtches.

It has a very unique design and IP65 waterproof, even in harsh environments.The Push Button Switch is designed to withstand harsh environments while being subjected to high rates of actuation.Examples of such can be found in material handling equipment such as loaders, lift trucks, bucket and shovel, and other applications where positioning of the load is critical.


Automotive Switches


Our Car Electrical Switches could equip with LED light or without light, which is according to our customer`s requirement. Meanwhile, our Automotive Push Button Switches could reach IP 67 waterproof rating. We have different shape of Automotive Electrical Switches for you to choose, comprising Square and Round.

Our Automotive Switches is normally used to turn on the car, and it is normally use the High Current to conduct the engine.


Car Switches


Automotive Switches,Automotive Toggle Switches,Automotive Toggle Switch,Automotive Electrical Switches,Automotive Accessory Switches

YESWITCH ELECTRONICS CO., LTD. , https://www.yeswitches.com