All pastes #270269 Raw Edit

Something

public text v1 · immutable
·published 2006-12-07 06:10 UTC
rendered paste body
#include <16f88.h>

int interrupted=0, all_on=0;
#INT_EXT
void ext_isr(void)
{
	if(interrupted)
		interrupted=0;
	else
		interrupted=1;
}

void main(void)
{
	set_tris_a(0x0F);
	set_tris_b(0x00);

	while(true)
	{
		all_on = input(PIN_A4); // all_on mapped to a button

		if(!interrupted && !all_on) //regular conditions
		{
			output_bit(PIN_B1, input(PIN_A0)); //map inputs straight to outputs
			output_bit(PIN_B2, input(PIN_A1));
			output_bit(PIN_B3, input(PIN_A2));			
		}
		else if(all_on && !interrupted)
		{
			output_bit(PIN_B1, 1);	//all on
			output_bit(PIN_B2, 1);
			output_bit(PIN_B3, 1);
		}
		else if(interrupted)
		{
			output_bit(PIN_B1, 0);  //system halt, all off
			output_bit(PIN_B2, 0);
			output_bit(PIN_B3, 0);			
		}
	}	
}