PSoC timer interrupt

It seems to me that my timer interrupt does not work correctly. Problem is that counter inside interrupt function increments only once. Here is my code from main and timer settings.

#include <m8c.h>
#include "PSoCAPI.h"
#include <stdio.h>
#include <stdlib.h>

char theStr[] = "PSoC LCD";
static char tmp[3];
static int counter = 0;

void main(void){

    while (1);

#pragma interrupt_handler myTimerInt
void myTimerInt(void){
    counter ++;
    itoa(tmp, counter, 10);


Most interrupt service routines need to re-arm the interrupt (sometimes called "acknowledging the interrupt) which called it. Otherwise, the ISR is only called once. Typically, this is done after the critical part of the ISR is complete.

In the case of the 503418, I think the reenabling is done by reading the counter register. See the code at the bottom of this.

A possible problem you might have is a misconfigured interrupt service routine in Timer8INT.asm. When using the directive #pragma interrupt_handler you need to make sure you're using the right instruction to call the C interrupt service routine in your Timer8INT.asm ISR.

If this directive is defined a reti instruction will be add to the end of that function which is incorrect if you use lcall to call that C function from your Timer8INT.asm. In this case you actually need a simple ljmp instruction to that C function.

When using directive #pragma interrupt_handler Timer8INT.asm should have


    ljmp _myTimerInt


Without directive #pragma interrupt_handler Timer8INT.asm should have


    lcall _myTimerInt


Need Your Help

Parallel.For interruption

c# .net parallel-processing parallel-extensions

Suppose you have an array of 1000 random integer numbers and you need to loop over it to find the number 68 for example.

Sorting a number's digits without using an array

arrays sorting

What I need to do for my homework is to sort the digits of a positive number from low to high.