cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with STDV-Cosmic compiler

lehuynamhieu1989
Associate
Posted on February 05, 2013 at 04:46

I am a newbie at cosmic and I met something strange when using STVD with cosmic compiler to run my project. I hope that somebody can explain it for me.

This is my project:

It is my main:

&sharpinclude ''peripheral.h''

&sharpinclude ''si4432.h''

static WORKING_AREA(waProtocolThread, 384);

void main(void)

{

    SetupSENSOR();

&sharpif 1

    /*Test NTC_Comparator 2*/

    while(1)

    {

        SI_ReadRegister(0x26);

    }

&sharpelse

     chThdCreateStatic(waProtocolThread, sizeof(waProtocolThread), NORMALPRIO, CP_SENSORThread, NULL);

&sharpendif

  while (TRUE) {};

}

And this is my subfunction SI_ReadRegister() stored in si4432.c

uint8_t SI_ReadRegister (const uint8_t Addr) {

    uint8_t Rpl;

    SI_NSEL_LO();

    SI_ReadWriteByte (Addr);

    Rpl =  SI_ReadWriteByte (0);

    SI_NSEL_HI();

    return Rpl;

}

The problem is: I want to set parameter Addr in subfunction to 0x26, however the value of this parameter is another number, and the value of Rpl is 0x26!

I attach a picture when debuging.

#cosmic #stvd
1 REPLY 1
elijah
Associate II
Posted on April 27, 2013 at 11:49

Is there any warnings during compile time?

is SI_ReadRegister () declared in si4432.h correctly?