INTERRUPT_ON_CHANGE_18f4550


//interrupt  on change


//PORTB pin to 7 IOC is used  as interrupt source
// any change on RB4 to RB7
//would drive pic to interrupt  and led lit



   #define led PORTC.f1


void main()
           {
           TRISC=0;           // output
           TRISB=0xf0;         //RB4 to RB7 as input
           ADCON1=0x0f;       // all port digital
           INTCON.RBIE=1;      //Enable portb Interrupt on chaner
           INTCON.RBIF=0;      // clear interrupt flag
            INTCON.GIE=1;

           for(;;)
           {

            }
         
           }
         
         
void interrupt()

            {

               led=~led;
               INTCON.INT1IF=0;

            }



Comments

Popular posts from this blog

stepper_28BY_and_with_driver_and-pic18f4550

Inductance caculator

polluted enviroment အဆိပ္သင့္ ရပ္ဝန္း