Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Interrupt on port B not working

Status
Not open for further replies.

AD76XYZ

Junior Member level 1
Joined
Jul 4, 2012
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,408
Hi,
I was testing port b interrupt.
Am using.
PIC16F886 @4MHz Internal Osc.
CCS C Version 4.105

I have connected LED on A0 and giving low signal on RB7-RB4 but no LED glow.
The pins RB7-RB4 is high, checked by logic probe.
Please where I did mistake.
Whenever I give logic zero to any of pin RB7-RB4 the LED should glow.


Code:
#include "KBD_WakeUp.h" 


#use delay(4000000) 
#int_RB 

#define LED PIN_A0 



void  RB_isr(void) 
{ 
clear_interrupt(INT_RB); 
output_bit(LED, 1); 
delay_ms(500); 
} 




void main() 
{ 

   setup_adc_ports(NO_ANALOGS|VSS_VDD); 
   setup_adc(ADC_CLOCK_DIV_2); 
   setup_spi(SPI_SS_DISABLED); 
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 
   setup_timer_1(T1_DISABLED); 
   setup_timer_2(T2_DISABLED,0,1); 
   setup_ccp1(CCP_OFF); 
   setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard 
   enable_interrupts(INT_RB); 
   enable_interrupts(GLOBAL); 
   setup_oscillator(OSC_4MHZ); 

   // TODO: USER CODE!! 
    
  
    
    
    
   set_tris_b(0x0F); 
   ext_int_edge(H_TO_L); 
   output_bit(LED,0); 
    
   while(1) 
   { 
   } 

}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top