• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

CCS Compiler: Interrupts

Status
Not open for further replies.

i2c2k

New Member
Hi!

I tried to write interrupts but the code doesn't work on my PIC16F876A:

CCS C-Compiler Code:
Code:
#include <16f876A.h>

#fuses HS,NOWDT,NOPROTECT,NOLVP
#use delay(clock=4000000)

inthdl_ext();


void main() {
   
   SET_TRIS_A ( 0b11111010 );
   SET_TRIS_B ( 0b00000001 );
   SET_TRIS_C ( 0b00000000 );
   
   enable_interrupts(INT_EXT);
   ext_int_edge(H_TO_L);

}

#INT_EXT
inthdl_ext() {
   output_bit(PIN_A2, 1);
   delay_ms(2000);
   output_bit(PIN_A2, 0);
}
The LED on Ra2 should be on for 2 seconds, but it doesn't unfortunately.
By the way putting "void" before "inthdl_ext()" does not affect the result.

cya
i2c2k[/code]
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top