PORT Change Interrupt PIC 16f877A
The microcontroller source program is as follows:
#define LED_1 PORTd.b0
#define LED_2 PORTd.b1
void interrupt()
{
if(INTCON.RBIF)
{
INTCON.RBIF = 0;
if(!PORTB.B4)
{
LED_1 = 0;
LED_2 = 1;
}
if(!PORTB.B7 )
{
LED_1 = 1;
LED_2 = 0;
}
}
}
void main(){
TRISB = 0XF0;
TRISD = 0X00;
PORTD = 0X00;
OPTION_REG.B7=0; // PORTB dahili pull-up aktif
INTCON.GIE=1; // allow other interrupts
INTCON.RBIE=1; // Allow PORTB to interrupt
INTCON.RBIF=0; // RBIF showroom?
LED_1 = 1;
delay_ms(1000);
LED_1 = 0;
while(1)
{
}
}
Previous article:Voltage output and display based on pic16f877a
Next article:dsPIC30F6014 CAN bus transmission function + DS18B20 temperature acquisition
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- Analysis of common causes of copper shedding in PCB factories
- 【micropython】Bluetooth BLE routine
- Suggestions on power consumption test of GD32L233C-START evaluation board
- Introduction to microphone head direction and recording effect
- RISC-V ESP32-C3 will become the new ESP8266
- Matters needing attention in the production of high-frequency microwave boards
- eMMC Summary (Forwarded)
- (Reprinted) Introduction to nRF5 chip peripherals GPIO and GPIOTE
- [ESP32-Korvo Review] 07 Compile the first project hello world
- 【Project source code】Design of XPT2046 touch controller based on FPGA