2 simple questions..
Which Microcontroller is used on the Gator, ATmega324PA or
ATmega324P ?
Is the ICP1 usable ? (ICP1 (Timer/Counter1 Input Capture Trigger))
On Duemilanove, I can use it like that. I would like to do the same
with the Gator:
void setup_timer1(){
//disable all interupts
TIMSK1 &= ~( _BV(TOIE1) | _BV(ICIE1) | _BV(OCIE1A) | _BV(OCIE1B));
//set timer mode
TCCR1A &= ~( _BV(WGM11) | _BV(WGM10) );
TCCR1B &= ~( _BV(WGM12) | _BV(WGM13) | _BV(ICNC1));
//capture raising edge
TCCR1B |= _BV(ICES1);
//prescaler 1/8
TCCR1B |= _BV(CS11);
TCCR1B &= ~( _BV(CS12) | _BV(CS10) );
//disable outputs
TCCR1A &= ~( _BV(COM1A0) | _BV(COM1A1) | _BV(COM1B0) | _BV(COM1B1));
//enable capture interupt
TIMSK1 |= (1<<ICIE1) + 1;
}
ISR(TIMER1_CAPT_vect){
unsigned char sreg;
/* Save global interrupt flag */
sreg = SREG;
mesureTemps.courant.a=ICR1;
SREG = sreg;
}
ISR(TIMER1_OVF_vect ){
noInterrupts();
mesureTemps.courant.b+=1;
interrupts();
}
thank you !
Philippe
It is the ATmega324P.
> Is the ICP1 usable ? (ICP1 (Timer/Counter1 Input Capture Trigger))
Yes it is.