#include <16F877.h>
#use delay(clock=4000000)
short estadobtn = 0;
int _65ms = 0;
#define LED PIN_B4
#INT_EXT
void isrrb0ext( void )
{
if( estadobtn == 0)
{
estadobtn = 1;
setup_timer_2( T2_DIV_BY_16, 0xFF, 16);
enable_interrupts( INT_TIMER2 );
}
else
{
estadobtn = 0;
disable_interrupts( INT_TIMER2 );
}
}
#INT_TIMER2
void isrtimer2( void )
{
_65ms++;
if( _65ms >= 62 )
{
output_toggle(LED);
_65ms = 0;
}
}
void main( void )
{
ext_int_edge( H_TO_L );
enable_interrupts( INT_EXT );
enable_interrupts( GLOBAL );
setup_timer_2( T2_DIV_BY_16, 0xFF, 16);
enable_interrupts( INT_TIMER2 );
while( true )
{
}
}