Hot!MCC and Mikroe click board ( Heart Rate sensor )

Author
Messerschmitt
Starting Member
  • Total Posts : 26
  • Reward points : 0
  • Joined: 2016/12/31 14:34:20
  • Location: 0
  • Status: offline
2017/11/24 16:34:39 (permalink)
0

MCC and Mikroe click board ( Heart Rate sensor )

Hi again.
   I'm trying to connect a Heart Rate sensor to a HPC Curiosity ( PIC18F46K22 ) on the MikroBUS. 
 I was struggling to add the libraries but I solved it. What happens now is that it wont build when Im using the example code generated from the MCC and Mikroe library. All I set manually is internal clock to work at 16Mhz and setting the MSSP1 module.

At the output window the error points to here:
 
main.c:86: error: (1098) conflicting declarations for variable "_HeartRate_example" (mcc_generated_files/heartrate_example.c:97)
(908) exit status = 1
nbproject/Makefile-default.mk:291: recipe for target 'dist/default/production/HeartRate.X.production.hex' failed
make[2]: Leaving directory 'C:/Users/Agustin Moscoso/MPLABXProjects/HeartRate.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed

void HeartRate_example(void) {
    irFilters.dcW = 0;
    irFilters.v_ctr[0] = 0;
    irFilters.v_ctr[1] = 0;
    tsLastSample = 0;
    irData = 0;
    state = BEATDETECTOR_STATE_INIT;
    threshold = BEATDETECTOR_MIN_THRESHOLD;
    beatPeriod = 0;
    lastMaxValue = 0;
    tsLastBeat = 0;
    tsLastReport = 0;
    bpmRate = 0;

    sampRate = getSampRate();
    TMR0_SetInterruptHandler(TMR0MS_ISR);

    while (1) {
        checkSample();
        if (checkTimeDiff(tsLastReport) > REPORTING_PERIOD_MS) {
            bpmRate = getBPMRate();
            tsLastReport = timer_ms;
        }
    }
}



and here is the highlighted error.

TMR0_SetInterruptHandler(TMR0MS_ISR);

 
This is generated with the library so I didn't write a single line. Did anyone had this problem? Im using the latest IDE, XC8 compiler and MCC version.
#1

4 Replies Related Threads

    du00000001
    Just Some Member
    • Total Posts : 1569
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: offline
    Re: MCC and Mikroe click board ( Heart Rate sensor ) 2017/11/24 17:15:38 (permalink)
    0
    Is HeartRate_Example called from the ISR as well?

    Most times the bug is in front of the keyboard.
    #2
    Messerschmitt
    Starting Member
    • Total Posts : 26
    • Reward points : 0
    • Joined: 2016/12/31 14:34:20
    • Location: 0
    • Status: offline
    Re: MCC and Mikroe click board ( Heart Rate sensor ) 2017/11/24 17:37:59 (permalink)
    0
    du00000001
    Is HeartRate_Example called from the ISR as well?


    You mean this?
     
     
    void TMR0MS_ISR(void);
    uint32_t checkTimeDiff(uint32_t time);
    uint16_t getSampRate(void);
    void checkSample(void);
    float dcRemoval(float x);
    float filterBuLp1(uint16_t x);
    bit checkForBeat(float value);
    void decreaseThreshold(void);
    float getBPMRate(void);
    /**
    Section: Example Code
    */
    void HeartRate_example(void) {
    irFilters.dcW = 0;
    irFilters.v_ctr[0] = 0;
    irFilters.v_ctr[1] = 0;
    tsLastSample = 0;
    irData = 0;
    state = BEATDETECTOR_STATE_INIT;
    threshold = BEATDETECTOR_MIN_THRESHOLD;
    beatPeriod = 0;
    lastMaxValue = 0;
    tsLastBeat = 0;
    tsLastReport = 0;
    bpmRate = 0;
    sampRate = getSampRate();
    TMR0_SetInterruptHandler(TMR0MS_ISR);
    while (1) {
    checkSample();
    if (checkTimeDiff(tsLastReport) > REPORTING_PERIOD_MS) {
    bpmRate = getBPMRate();
    tsLastReport = timer_ms;
    }
    }
    }
    // TMR0 Interrupt Handler (millisecond counter)
    void TMR0MS_ISR(void) {
    if (timer_ms < 0x7FFFFFFF) {
    timer_ms++;
    } else {
    timer_ms = 0;
    }
    }

     
    #3
    cobusve
    Super Member
    • Total Posts : 363
    • Reward points : 0
    • Joined: 2012/04/02 16:15:40
    • Location: Chandler
    • Status: offline
    Re: MCC and Mikroe click board ( Heart Rate sensor ) 2017/12/02 20:45:48 (permalink)
    0
    Can you please use the "package" option under the file menu and send the zip file generated to mcc_support@microchip.com We would like to understand what went wrong for you.
     
    There is too little information in the post to make an accurate assessment, but that error means that a variable is declared in more than one place with conflicting details. This can happen if you have something in a .h file where it should be in a .c file, and it can also happen if there is a stray character in one of your files somewhere and the compiler may be flagging the next file as having a problem.

    If we have the full project we should be able to fix this for you immediately.
    #4
    niladree
    New Member
    • Total Posts : 1
    • Reward points : 0
    • Joined: 2017/12/11 21:52:28
    • Location: 0
    • Status: offline
    Re: MCC and Mikroe click board ( Heart Rate sensor ) 2017/12/12 20:23:18 (permalink)
    0
    Issue: With reference to the shared project heartrate.X.rar. I can see TMR0 module is not added. The generated code uses Timer0 interrupt "TMR0_SetInterruptHandler(TMR0MS_ISR);" for its internal calculation which in turn gives compilation error if not included.
     
    Resolution:  At the bottom of the Heart Rate Sensor configuration page the expected settings are highlighted https://ibb.co/iaTxN6
     
     The below operations has to be performed
    1) Manually add Timer/TMR0 module and configure "Requested Period" to 1ms
    2) Enable Timer Interrupt in TMR0 module
    3) Configure  Heartrate parameters in the UI
    Sample: 100 SPS, Pulse Width: 1600us, 
    #5
    Jump to:
    © 2018 APG vNext Commercial Version 4.5