This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

A simple problem with atomic instructions

Hi
I am using this code in my program:

_inline void Local_Clear( U8 StackerID ) {
        U8 idata idx;
        idx = StackerID-3;
        _atomic_(0); TxSpiBuff[idx] &= 0x0fff; TxSpiBuff[idx] |= 0x3000;    _endatomic_();
}

But after compiling, this error is shown:
MainTask.c(804): error C185: atomic #8: out of range

I know what is happening, but I want a good solution. A solution to this problem is that I duplicate the function for each StackerID (the parameter) and eliminate it from the parameter list, so the idx will be a constant and the error is resolved. But I am seeking for a better solution.

Thanks all