MCC does not work
This commit is contained in:
parent
23904b03ea
commit
14c09f63a9
0
prosjekt.X/defmplabxtrace.log
Normal file
0
prosjekt.X/defmplabxtrace.log
Normal file
BIN
prosjekt.X/defmplabxtrace.log.inx
Normal file
BIN
prosjekt.X/defmplabxtrace.log.inx
Normal file
Binary file not shown.
@ -23,11 +23,42 @@ uint16_t RPM_calculation() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PORT_init(){
|
void PORT_init(){
|
||||||
PORTD.PIN2CTRL = PORT_ISC_FALLING_gc;
|
//compare or capture
|
||||||
|
TCB3.CCMP = 0x00;
|
||||||
|
//count
|
||||||
|
TCB3.CNT = 0x00;
|
||||||
|
|
||||||
|
|
||||||
|
//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.EVCTRL =1<< TCB_CAPTEI_bp /* Event Input Enable: enabled */|0<< TCB_EDGE_bp /* Event Edge: disabled */|0<< TCB_FILTER_bp;/* Input Capture Noise Cancellation Filter: disabled */
|
||||||
|
// TCB3.INTCTRL =1<< TCB_CAPT_bp /* Capture or Timeout: enabled */|0<< TCB_OVF_bp;/* OverFlow Interrupt: 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;
|
||||||
|
TCB2.CTRLB = 0x15;
|
||||||
|
|
||||||
|
//DBGRUN disabled;
|
||||||
|
TCB2.DBGCTRL = 0x00;
|
||||||
|
|
||||||
|
//FILTER disabled; EDGE disabled; CAPTEI enabled;
|
||||||
|
TCB2.EVCTRL = 0x01;
|
||||||
|
|
||||||
|
//OVF disabled; CAPT enabled;
|
||||||
|
TCB2.INTCTRL = 0x01;
|
||||||
|
|
||||||
|
//OVF disabled; CAPT disabled;
|
||||||
|
TCB2.INTFLAGS = 0x00;
|
||||||
|
|
||||||
|
//Temporary Value
|
||||||
|
TCB2.TEMP = 0x00;
|
||||||
|
|
||||||
|
//RUNSTDBY disabled; CASCADE disabled; SYNCUPD disabled; CLKSEL DIV1; ENABLE enabled;
|
||||||
|
TCB2.CTRLA = 0x01;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
ISR ( TCA0_OVF_vect ) {
|
ISR ( TCA0_OVF_vect ) {
|
||||||
cli();
|
cli();
|
||||||
RPM_calculation();
|
RPM_calculation();
|
||||||
@ -35,14 +66,26 @@ ISR ( TCA0_OVF_vect ) {
|
|||||||
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm ;
|
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm ;
|
||||||
|
|
||||||
sei();
|
sei();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
ISR (TCB3_INT_vect){
|
||||||
|
uint16_t yo = TCB3.CNT;
|
||||||
|
printf("CNT %u", yo);
|
||||||
|
|
||||||
|
uint16_t stewui = TCB3.CCMP;
|
||||||
|
printf("CCMP %u", stewui);
|
||||||
|
|
||||||
|
//TCB3.INTFLAGS = PIN0_bm;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
ISR(PORTD_PORT_vect){
|
ISR(PORTD_PORT_vect){
|
||||||
cli();
|
// cli();
|
||||||
falling_edge_counter ++;
|
falling_edge_counter ++;
|
||||||
|
|
||||||
PORTD.INTFLAGS = PIN2_bm;
|
PORTD.INTFLAGS = PIN2_bm;
|
||||||
sei();
|
//sei();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
* */
|
||||||
|
|||||||
@ -27,15 +27,14 @@
|
|||||||
|
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
|
|
||||||
sei();
|
|
||||||
init_uart((uint16_t)9600);
|
init_uart((uint16_t)9600);
|
||||||
stdout = &USART_stream;
|
stdout = &USART_stream;
|
||||||
TCA0_init ();
|
TCA0_init ();
|
||||||
PORT_init();
|
PORT_init();
|
||||||
|
sei();
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
|
//printf("loop")
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -13,6 +13,7 @@
|
|||||||
displayName="Important Files"
|
displayName="Important Files"
|
||||||
projectFiles="true">
|
projectFiles="true">
|
||||||
<itemPath>Makefile</itemPath>
|
<itemPath>Makefile</itemPath>
|
||||||
|
<itemPath>prosjekt.mc3</itemPath>
|
||||||
</logicalFolder>
|
</logicalFolder>
|
||||||
<logicalFolder name="LinkerScript"
|
<logicalFolder name="LinkerScript"
|
||||||
displayName="Linker Files"
|
displayName="Linker Files"
|
||||||
@ -38,8 +39,8 @@
|
|||||||
<targetPluginBoard></targetPluginBoard>
|
<targetPluginBoard></targetPluginBoard>
|
||||||
<platformTool>nEdbgTool</platformTool>
|
<platformTool>nEdbgTool</platformTool>
|
||||||
<languageToolchain>XC8</languageToolchain>
|
<languageToolchain>XC8</languageToolchain>
|
||||||
<languageToolchainVersion>2.46</languageToolchainVersion>
|
<languageToolchainVersion>2.45</languageToolchainVersion>
|
||||||
<platform>3</platform>
|
<platform>2</platform>
|
||||||
</toolsSet>
|
</toolsSet>
|
||||||
<packs>
|
<packs>
|
||||||
<pack name="AVR-Dx_DFP" vendor="Microchip" version="2.4.286"/>
|
<pack name="AVR-Dx_DFP" vendor="Microchip" version="2.4.286"/>
|
||||||
|
|||||||
8047
prosjekt.X/prosjekt.mc3
Normal file
8047
prosjekt.X/prosjekt.mc3
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user