This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Why we use "|=" and "&=" instead of simple "=" ?

 I red codes but I could not understand when we set the direction of a pin or any other register why we use "|=" or "&=" for negation instead of simple "=" ?

  • We use |= for setting some bits and other for clearing bits without affecting other bits. Please go through basic C bitwise operators for information.
    This is a device forum in which we will support only device, peripheral and MCSDK related queries.

    Thank you.
  • Hi Luqman,
    I am closing this thread and please refer how to set, clear and toggle a single bit using C for more information.

    Thank you.