Tarik Mokafih
Tarik Mokafih

Reputation: 1257

Function not being executed at all or doesn't execute properly

i'm working on an embedded C program, where the killnoise function is not executed even if it is called and the program always reach it, but when i chek the values at the output of this function i just discover that nothig happened:

void KillNoise( int* array, int size )
{
  int k;

    for (k=0;k<size;k++)
    {
       if (array[k] < 20)
           array[k] = 0;
    }

}

here is where and how i call it :

void UX_zswDecide( void )
{
    float __xdata centerOfMass[UX_NUM_SENSORS];
    float __xdata vectx, vecty, module, tg;
    int __xdata i,j;

    KillNoise( UX_bigUpArray,    NUMPOINTS );
    KillNoise( UX_bigDownArray,  NUMPOINTS );
    KillNoise( UX_bigLeftArray, NUMPOINTS );
    KillNoise( UX_bigRightArray,  NUMPOINTS );

/* the rest of the function */ 
}

where NUMPOINTS, biguparray, bigleftarray ... are global variables declared previously:

int   __xdata UX_bigUpArray[100];

int   __xdata UX_bigDownArray[100] ;

int   __xdata UX_bigLeftArray[100];
int   __xdata UX_bigRightArray[100] ;

#define NUMPOINTS 100 

thank you a lot for your help, (i'm facing the same issue with another function)

Upvotes: 2

Views: 1171

Answers (1)

JeremyP
JeremyP

Reputation: 86651

I think you need __xdata in the declaration of the array parameter in KillNoise

void KillNoise( int* __xdata array, int size )

or something similar.

Upvotes: 1

Related Questions