Any minimum sample code? It could help us better understand your requirements I guess.
char en1 [] = "fast";
char en2 [] = "slow";
char wk [] = "wakeup";
void ADC_ready(void)
{
// here i have to know what command it was executed
// this is a special function that will automatic trigger by hardware
// it will enter here every 58.8uS as required by my final purpose
}
void main(void)
{
set_tris_b(0b01111111);
setup_port_a( AN0_AN1_AN3 );
setup_adc(ADC_CLOCK_DIV_32);
set_adc_channel( 0 );
delay_us(20);
setup_timer_1( T1_INTERNAL | T1_DIV_BY_2 );
setup_ccp2( CCP_COMPARE_RESET_TIMER );
CCP_2=147;
enable_interrupts( INT_AD );
enable_interrupts( GLOBAL );
while (TRUE)
{
menu();
}
}
void menu()
{
char input_str[10];
gets(input_str);
if (!strcmp(input_str,wk))
{
printf("OK");
gets(input_str);
if (!strcmp(input_str,en1))
fast();
if (!strcmp(input_str,en2))
slow();
}
}