Skip to main content
paulrbryson
Associate III
April 24, 2015
Question

Bit Variables ISR Safe?

  • April 24, 2015
  • 2 replies
  • 1087 views
Posted on April 24, 2015 at 20:43

I am using the Cosmic compiler and I want to read and write bit variables in an ISR.  I am wondering if there is a guarantee that ALL bit variable manipulations are atomic (ie using bitwise instructions).  

If not - since multiple bit variables are stored within a single byte I would have to bracket every access of every bit variable with interrupt masking. 
    This topic has been closed for replies.

    2 replies

    luca239955_stm1_st
    Associate
    April 27, 2015
    Posted on April 27, 2015 at 16:46

    Hello,

    what you ask is guaranteed for bit global variables.

    Regards,

    Luca (Cosmic)

    paulrbryson
    Associate III
    April 27, 2015
    Posted on April 27, 2015 at 23:30

    Thank you.  Bit variables will save me a lot of memory.