Compare commits
No commits in common. "57a35a483d801cfd8821447518eb1dfd36f0e638" and "58014e17d15e633f2c2d2e4d0428f0f30c452d5e" have entirely different histories.
57a35a483d
...
58014e17d1
@ -24,12 +24,10 @@ uint16_t RPM_calculation() {
|
|||||||
|
|
||||||
void PORT_init(){
|
void PORT_init(){
|
||||||
//compare or capture
|
//compare or capture
|
||||||
//TCB3.CCMP = 0x00;
|
TCB3.CCMP = 0x00;
|
||||||
//count
|
//count
|
||||||
TCB3.CNT = 0x00;
|
TCB3.CNT = 0x00;
|
||||||
|
|
||||||
PORTA.IN = PIN0_bm;
|
|
||||||
PORTA.PIN0CTRL = PORT_PULLUPEN_bm;
|
|
||||||
|
|
||||||
//PORTD.PIN2CTRL = PORT_ISC_FALLING_gc | 0b01000000;
|
//PORTD.PIN2CTRL = PORT_ISC_FALLING_gc | 0b01000000;
|
||||||
// TCB3.CTRLB =0<< TCB_ASYNC_bp /* Asynchronous Enable: disabled */|0<< TCB_CCMPEN_bp /* Pin Output Enable: disabled */|0<< TCB_CCMPINIT_bp /* Pin Initial State: disabled */| TCB_CNTMODE_FRQ_gc;/* Input Capture Frequency measurement */
|
// TCB3.CTRLB =0<< TCB_ASYNC_bp /* Asynchronous Enable: disabled */|0<< TCB_CCMPEN_bp /* Pin Output Enable: disabled */|0<< TCB_CCMPINIT_bp /* Pin Initial State: disabled */| TCB_CNTMODE_FRQ_gc;/* Input Capture Frequency measurement */
|
||||||
@ -38,31 +36,30 @@ void PORT_init(){
|
|||||||
// TCB3.CTRLA = TCB_CLKSEL_DIV1_gc /* CLK_PER */|1<< TCB_ENABLE_bp /* Enable: enabled */|0<< TCB_RUNSTDBY_bp /* Run Standby: disabled */|0<< TCB_SYNCUPD_bp /* Synchronize Update: disabled */|0<< TCB_CASCADE_bp;/* Cascade Two Timer/Counters: disabled */
|
// TCB3.CTRLA = TCB_CLKSEL_DIV1_gc /* CLK_PER */|1<< TCB_ENABLE_bp /* Enable: enabled */|0<< TCB_RUNSTDBY_bp /* Run Standby: disabled */|0<< TCB_SYNCUPD_bp /* Synchronize Update: disabled */|0<< TCB_CASCADE_bp;/* Cascade Two Timer/Counters: disabled */
|
||||||
|
|
||||||
//ASYNC disabled; CCMPINIT disabled; CCMPEN disabled; CNTMODE FRQPW;
|
//ASYNC disabled; CCMPINIT disabled; CCMPEN disabled; CNTMODE FRQPW;
|
||||||
TCB3.CTRLB = 0x04;
|
TCB3.CTRLB = 0x15;
|
||||||
|
|
||||||
//DBGRUN disabled;
|
//DBGRUN disabled;
|
||||||
//TCB3.DBGCTRL = 0x00;
|
TCB3.DBGCTRL = 0x00;
|
||||||
|
|
||||||
//FILTER disabled; EDGE disabled; CAPTEI enabled;
|
//FILTER disabled; EDGE disabled; CAPTEI enabled;
|
||||||
TCB3.EVCTRL = 0x01;
|
TCB3.EVCTRL = 0x01;
|
||||||
|
|
||||||
//OVF disabled; CAPT enabled;
|
//OVF disabled; CAPT enabled;
|
||||||
TCB3.INTCTRL = 0x01;
|
TCB3.INTCTRL = 0x03;
|
||||||
|
|
||||||
//OVF disabledAPT disabled;
|
//OVF disabled; CAPT disabled;
|
||||||
//TCB3.INTFLAGS = 0; CAPT disabled;
|
TCB3.INTFLAGS = 0x00;
|
||||||
//TCB3.INTFLAGS = 0x00;
|
|
||||||
|
|
||||||
//Temporary Value
|
//Temporary Value
|
||||||
//TCB3.TEMP = 0x00;
|
TCB3.TEMP = 0x00;
|
||||||
|
|
||||||
|
|
||||||
EVSYS.CHANNEL0 = 0x40;
|
|
||||||
//EVSYS.SWEVENTA = 0x01;
|
|
||||||
EVSYS.USERTCB3CAPT = 0x01;
|
|
||||||
|
|
||||||
//RUNSTDBY disabled; CASCADE disabled; SYNCUPD disabled; CLKSEL DIV1; ENABLE enabled;
|
//RUNSTDBY disabled; CASCADE disabled; SYNCUPD disabled; CLKSEL DIV1; ENABLE enabled;
|
||||||
TCB3.CTRLA = 0x01;
|
TCB3.CTRLA = 0x01;
|
||||||
|
|
||||||
|
EVSYS.CHANNEL0 = 0x48 + 0x05;
|
||||||
|
EVSYS.SWEVENTA = 0x01;
|
||||||
|
EVSYS.USERTCB3CAPT = 0x01;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCB0_Init(void){
|
void TCB0_Init(void){
|
||||||
@ -100,17 +97,15 @@ ISR ( TCA0_OVF_vect ) {
|
|||||||
sei();
|
sei();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void printnie(uint8_t en, uint8_t to){
|
|
||||||
printf("CNT %u", en);
|
|
||||||
printf("ccmp %u", to);
|
|
||||||
}
|
|
||||||
|
|
||||||
ISR (TCB3_INT_vect){
|
ISR (TCB3_INT_vect){
|
||||||
uint16_t yo = TCB3.CNT;
|
uint16_t yo = TCB3.CNT;
|
||||||
|
printf("CNT %u", yo);
|
||||||
uint16_t stewui = TCB3.CCMP;
|
|
||||||
|
printf("too");
|
||||||
|
|
||||||
|
uint16_t stewui = TCB3.CCMP;
|
||||||
|
printf("CCMP %u", stewui);
|
||||||
|
|
||||||
printnie(yo, stewui);
|
|
||||||
TCB3.INTFLAGS = 0x03;
|
TCB3.INTFLAGS = 0x03;
|
||||||
//TCB3.INTFLAGS = PIN0_bm;
|
//TCB3.INTFLAGS = PIN0_bm;
|
||||||
|
|
||||||
|
|||||||
@ -41,25 +41,13 @@ int main() {
|
|||||||
sei();
|
sei();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
/*
|
|
||||||
printf("loop");
|
//printf("loop");
|
||||||
uint16_t yo = TCB3.CNT;
|
//uint16_t yo = TCB3.CNT;
|
||||||
printf("CNT %u", yo);
|
//printf("CNT %u", yo);
|
||||||
uint16_t stewui = TCB3.CCMP;
|
|
||||||
printf("CCMP %u", stewui);
|
//uint16_t stewui = TCB3.CCMP;
|
||||||
*/
|
//printf("CCMP %u", stewui)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*ISR (TCB3_INT_vect){
|
|
||||||
uint16_t yo = TCB3.CNT;
|
|
||||||
printf("CNT %u", yo);
|
|
||||||
|
|
||||||
uint16_t stewui = TCB3.CCMP;
|
|
||||||
printf("CCMP %u", stewui);
|
|
||||||
|
|
||||||
TCB3.INTFLAGS = 0x03;
|
|
||||||
//TCB3.INTFLAGS = PIN0_bm;
|
|
||||||
|
|
||||||
}*/
|
|
||||||
Loading…
Reference in New Issue
Block a user