PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 05, 2010 11:38 pm |
|
|
I've modified your program so it should work. If press the button on
pin B7 down, the LED will go on. When you release the button, the LED
will go off.
Code: |
#include <16F886.h>
#fuses INTRC_IO, NOWDT, BROWNOUT, PUT, NOLVP
#use delay(clock=4000000)
#define SW_PIN PIN_B7
#define LED_PIN PIN_A1
#int_rb
void rb_isr(void)
{
int8 value;
output_toggle(LED_PIN);
delay_ms(10);
value = input(SW_PIN);
}
//============================
void main()
{
int8 temp;
output_low(LED_PIN);
temp = input(SW_PIN);
clear_interrupt(INT_RB);
enable_interrupts(INT_RB7);
enable_interrupts(GLOBAL);
while(1);
} |
|
|