which I don't know how to avoid.Serious Warning: Possible sw stack corruption, function 'delay_us' called by more than one asynchronous thread (main/Task, interrupt, interrupt low)

Due to IP concerns I cannot attach the whole program anymore, but here is the routine that I suspect falls over with and without the var:

Code: Select all

`MX_UINT8 FCM_Hex2Int(MX_CHAR* PFCL_HEX2_INT_STR)`

{

//Local variable definitions

MX_UINT8 FCL_LENGTH;

MX_UINT8 FCL_COUNT = (0x0);

MX_UINT8 FCL_INT_VALUE = (0x0);

MX_UINT8 FCL_INT_CONVERSION = (0x0);

MX_UINT8 FCL_INT_VAR = (0x0);

MX_UINT8 FCL_INDEX = (0x0);

#define FC_SZ_HEX2_INT_STR 20

MX_UINT8 FCL_HEX2_INT_STR[FC_SZ_HEX2_INT_STR];

FCI_CONCATENATE(PFCL_HEX2_INT_STR,FC_SZ_HEX2_INT_STR,"",0,FCL_HEX2_INT_STR,FC_SZ_HEX2_INT_STR);

MX_UINT8 FCR_RETVAL;

//String Manipulation

//Calculation:

// .length = Length$ (.hex2_int_str)

FCL_LENGTH = FCI_GETLENGTH(FCL_HEX2_INT_STR, FC_SZ_HEX2_INT_STR);

//Calculation

//Calculation:

// .count = 0

// .int_value = 0

// .int_conversion = 0

FCL_COUNT = 0;

FCL_INT_VALUE = 0;

FCL_INT_CONVERSION = 0;

//Loop

//Loop: While .count < .length

while (1)

{

//Calculation

//Calculation:

// .int_var = (.length - .count) - 1

FCL_INT_VAR = (FCL_LENGTH - FCL_COUNT) - 1;

//Calculation

//Calculation:

// .index = (.length - .count) - 1

// .int_var = .hex2_int_str[.index]

FCL_INDEX = (FCL_LENGTH - FCL_COUNT) - 1;

FCL_INT_VAR = FCL_HEX2_INT_STR[FCL_INDEX];

//Decision

//Decision: .int_var > 64?

if (FCL_INT_VAR > 64)

{

//Calculation

//Calculation:

// .int_var = .int_var - 55

FCL_INT_VAR = FCL_INT_VAR - 55;

} else {

//Calculation

//Calculation:

// .int_var = .int_var - 48

FCL_INT_VAR = FCL_INT_VAR - 48;

}

//Calculation

//Calculation:

// .int_value = .int_var << .count * 4

// .int_conversion = .int_conversion + .int_value

FCL_INT_VALUE = FCL_INT_VAR << FCL_COUNT * 4;

FCL_INT_CONVERSION = FCL_INT_CONVERSION + FCL_INT_VALUE;

//Calculation

//Calculation:

// .count = .count + 1

FCL_COUNT = FCL_COUNT + 1;

if ((FCL_COUNT < FCL_LENGTH) == 0) break;

}

//Calculation

//Calculation:

// .Return = .int_conversion

FCR_RETVAL = FCL_INT_CONVERSION;

return (FCR_RETVAL);

//Local variable definitions

#undef FC_SZ_HEX2_INT_STR

}

Any ideas?

TIA