Heart Rate 5 Timer

General discussion on mikroC PRO for PIC32.
Post Reply
Author
Message
josephbarrymore
Posts: 5
Joined: 27 Nov 2018 23:28

Heart Rate 5 Timer

#1 Post by josephbarrymore » 07 Dec 2018 19:12

I ended up buying the Fusion 7 board with the expected PIC32MX795 processor. I want to run the Heart rate 5 click board.

Unfortunately the timer does not work in the example! I can tell this because flag is never set and ms_counter never changes!

This is the problematic code:

Code: Select all

#include "Click_Heart_Rate_5_types.h"

uint32_t ms_counter;
uint8_t flag;

void InitTimer(){
  // 3.9ms Timer interrupt for sampling 
  T1CON         = 0x8010;
  T1IP0_bit         = 1;
  T1IP1_bit         = 1;
  T1IP2_bit         = 1;
  T1IF_bit         = 0;
  T1IE_bit         = 1;
  PR1                 = 39000;
  TMR1                 = 0;
}

void Timer1Interrupt() iv IVT_TIMER_1 ilevel 7 ics ICS_SRS {
  T1IF_bit         = 0;
  //Enter your code here
  ms_counter++;
  flag=1;
}

Additionally, as soon as any call to a bus is made (UART, I2C), the debugger will ignore all further breakpoints and let the code run freely. Is the debugger broken? Is there a way to update the debugger firmware so that it does not have this behavior?
It makes the debugger entirely useless!

josephbarrymore
Posts: 5
Joined: 27 Nov 2018 23:28

Re: Heart Rate 5 Timer

#2 Post by josephbarrymore » 07 Dec 2018 23:34

Found it! The example didn't add a call to EnableInterrupts();

You guys need to update the example, otherwise it can't be run!

Is it possible to find out what the pre-compiled call to "heartrate5_getAled1val()" is doing?
Is it gathering the raw data, or is the data being smoothed somehow?

Thanks

User avatar
petar.suknjaja
mikroElektronika team
Posts: 683
Joined: 05 Mar 2018 09:44
Location: Belgrade

Re: Heart Rate 5 Timer

#3 Post by petar.suknjaja » 12 Dec 2018 09:39

Hi Joseph,
Thank you for letting us know, I will investigate this and update the example.
Regarding the heartrate5_getAled1val, I'll ask for source code.
Kind regards,
Petar

Post Reply

Return to “mikroC PRO for PIC32 General”