timer
This commit is contained in:
parent
6528a82b04
commit
022ccb13a0
@ -38,17 +38,10 @@ uint16_t RPM_calculation(uint16_t test, uint16_t time) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void PORTB_init() {
|
void PORTB_init() {
|
||||||
PORTA.OUTSET |= PIN5_bm;
|
PORTA.OUTSET |= PIN5_bm;
|
||||||
PORTA.DIRSET |= PIN5_bm;
|
PORTA.DIRSET |= PIN5_bm;
|
||||||
}
|
}
|
||||||
// Voltage reference
|
|
||||||
#define VDACREF
|
|
||||||
#define VREF
|
|
||||||
#define DACREF_VALUE (VDACREF * 256 / VREF)
|
|
||||||
|
|
||||||
|
|
||||||
void init_ac0(){
|
void init_ac0(){
|
||||||
// CONFIGURE PINS AS ANALOG INPUTS
|
// CONFIGURE PINS AS ANALOG INPUTS
|
||||||
@ -86,10 +79,13 @@ void test(){
|
|||||||
|
|
||||||
ISR(AC0_AC_vect){ // AC0 vec flag
|
ISR(AC0_AC_vect){ // AC0 vec flag
|
||||||
AC0.STATUS |= 0x10; //CMP flag to 0.
|
AC0.STATUS |= 0x10; //CMP flag to 0.
|
||||||
|
falling_edge_counter++;
|
||||||
//printf("yo");
|
//printf("yo");
|
||||||
test();
|
test();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------------
|
||||||
//-------------------------------------- S E T U P-----------------------------------------------------
|
//-------------------------------------- S E T U P-----------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -35,6 +35,7 @@ int main(void) {
|
|||||||
|
|
||||||
init_uart((uint16_t)9600);
|
init_uart((uint16_t)9600);
|
||||||
stdout = &USART_stream;
|
stdout = &USART_stream;
|
||||||
|
init_TCA0();
|
||||||
init_ac0();
|
init_ac0();
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user