void checkinput(int pro[], int sgte[]) { if (buscar(pro)==0){ volcar(pro,sgte); scanto(volcar(pro,sgte)); } }
void main(void) { uart_init(); PORTD = _BV(PD2); /* resistor de pull-up */ MCUCR = _BV(ISC01); /* int0 por flanco H->L */ GICR = _BV(INT0); /* int0 habilitada */ TIMSK = _BV(OCIE1A); /* interrupion por comparacion */ TCCR1B = _BV(WGM12); /* modo de borrado del timer cuando cuando la comparacion coincide */ OCR1A = 124; /* cuento 125 ints de timer 1MHz / 8 = 125000 da un margen de 1000 overflows */ sei(); while(1) { switch(menu()) { case 'c': configuracion(); case 'r': TCCR1B &= ~(_BV(CS11)); /* detiene el timer */ TCNT1 = 0; /* timer a cero */ for (i = 0; i < MAX_MEDICIONES; i++) valores[i] = 0; i = 0; x = 0; break; case 'v': volcar(); break; default: printf("\n ERROR: opcion invalida\n"); } } }