PIC 16f877a PORTB State Change Interrupt Simulation and Source Code

Publisher:Lihua1314520Latest update time:2019-11-09 Source: 51heiKeywords:PIC  16f877a  PORTB  State  Change  Interrupt Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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)

        {


        }

}




Keywords:PIC  16f877a  PORTB  State  Change  Interrupt Reference address:PIC 16f877a PORTB State Change Interrupt Simulation and Source Code

Previous article:Voltage output and display based on pic16f877a
Next article:dsPIC30F6014 CAN bus transmission function + DS18B20 temperature acquisition

Latest Microcontroller Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号