0

I'm new to harmony framework, and am trying to find how i can count timer iterations, so i'm doing a simple test.

I configured the timer like this:

enter image description here

Now i want to know if this is the correct way:

    uint32_t teste;
    case APP_STATE_SERVICE_TASKS:
    {
        while(1){
            teste = DRV_TMR0_CounterValueGet;
            printf("tmr val %d \r\n",teste);
            DRV_TMR0_CounterValueSet(0);
        }

        break;
    }

It happens that when i go see the print it's always the number 1660931680 doesn't make much sense to me, the timer is 16-bit so the maximum number should be somewhere near 65500.

What is wrong here?

Nmaster88
  • 381
  • 5
  • 20

1 Answers1

0

You are probably getting the memory address of the DRV_TMR0_CounterValueGet function rather than the return value because you didn't call the function. You must call the function with () i.e.

teste = DRV_TMR0_CounterValueGet();

(not teste = DRV_TMR0_CounterValueGet;)

pm101
  • 505
  • 3
  • 13
  • Hi @pm101 thanks it is always 0 now even after taking away DRV_TMR0_CounterValueSet(0);, do you know whats missing? i did DRV_TMR0_Start(); on APP_STATE_INIT – Nmaster88 Jun 13 '19 at 07:46
  • Ok i found what was wrong, i had timer period equal to one. I need to understand it now. – Nmaster88 Jun 13 '19 at 08:00