TIMER0_OVF and TIMER2_OVF

Hi all, I’m tried to use the interruption from Timer2_ovf and Timer0_ovf an atmega128 but it doesn’t work out. The INT0 and INT1 vector work fine. I’m posting my code so that you could figure out. #include <stdlib.h> #include <string.h> #include <stdio.h> #ifdef GCC_MEGA_AVR     /* EEPROM routines used only with the WinAVR compiler. */     #include <avr/eeprom.h> #endif /* Scheduler include files. */ #include "FreeRTOS.h" #include "task.h" #include "croutine.h" #include "semphr.h" #include <avr/interrupt.h> #include <avr/sleep.h> #include <../../Source/include/semphr.h> #include <math.h> /* Demo file headers. */ #include "PollQ.h" #include "integer.h" #include "serial.h" #include "comtest.h" #include "crflash.h" #include "print.h" #include "partest.h" #include "regtest.h" #define SIGNAL    __attribute__ ((signal)) /* Baud rate used by the serial port tasks. */ #define mainCOM_TEST_BAUD_RATE            ( ( unsigned portLONG ) 38400 ) void TIMER0_OVF(void)__attribute__ ((signal,naked)); void vApplicationIdleHook( void ); /*———————————————————–*/ portSHORT main( void ) {     /* Registers */     SREG  = 0x80;     MCUCR = 0x03;     EICRA = 0x0F;     EIMSK = 0x03;     TIMSK = 0x01;     TCCR0 = 0x03;         xSerialPortInitMinimal( mainCOM_TEST_BAUD_RATE, 1 );     vParTestInitialise();         while(1);     return 0; } /*———————————————————–*/ ISR(TIMER0_OVF_vect) // INT_0 or INT_1 work out!!! {     vParTestToggleLED( 1);         vParTestInitialise(); } void vApplicationIdleHook( void ) {     vCoRoutineSchedule(); } Thanks, for all!!!!

TIMER0_OVF and TIMER2_OVF

Dont know the answer but dont think it is anything todo with FreeRTOS so must just be in the register settings. Are there examples in the compiler to copy?

TIMER0_OVF and TIMER2_OVF

See my thread here https://sourceforge.net/forum/forum.php?thread_id=1882976&forum_id=382005 The default is for Timer1 not 0 or 2 (8-bit) or 3(second 16-bit timer) If you want to change it, you need to modify the port.c file ..FreeRTOSSourceportableGCCATMega323 #define portCOMPARE_MATCH_A_INTERRUPT_ENABLE    ( ( unsigned portCHAR ) 0x10 ) //set it to the correct interrupt mask for TIMER3 if you like /* * Setup timer 1 compare match A to generate a tick interrupt. */ static void prvSetupTimerInterrupt( void ) { unsigned portLONG ulCompareMatch; unsigned portCHAR ucHighByte, ucLowByte;     /* Using 16bit timer 1 to generate the tick.  Correct fuses must be     selected for the configCPU_CLOCK_HZ clock. */     ulCompareMatch = configCPU_CLOCK_HZ / configTICK_RATE_HZ;     /* We only have 16 bits so have to scale to get our required tick rate. */     ulCompareMatch /= portCLOCK_PRESCALER;     /* Adjust for correct value. */     ulCompareMatch -= ( unsigned portLONG ) 1;     /* Setup compare match value for compare match A.  Interrupts are disabled     before this is called so we need not worry here. */     ucLowByte = ( unsigned portCHAR ) ( ulCompareMatch & ( unsigned portLONG ) 0xff );     ulCompareMatch >>= 8;     ucHighByte = ( unsigned portCHAR ) ( ulCompareMatch & ( unsigned portLONG ) 0xff );     OCR1AH = ucHighByte;     OCR1AL = ucLowByte; //Change to OCR3AH and AL     /* Setup clock source and compare match behaviour. */     ucLowByte = portCLEAR_COUNTER_ON_MATCH | portPRESCALE_64;     TCCR1B = ucLowByte; // Make sure the correct register for TIMER3     /* Enable the interrupt – this is okay as interrupt are currently globally     disabled. */     ucLowByte = TIMSK;     ucLowByte |= portCOMPARE_MATCH_A_INTERRUPT_ENABLE;     TIMSK = ucLowByte; } too bad no way to mark up my comments Jay