Bit management in a word

Solved
PerkyPlatipus -  
 PerkyPlatipus -
Bonjour,

I have a variable toto that is 16 bits.
According to several conditions, the bits need to be set to 1.
But I don't know how to do that. (structured program)

Let me explain:
If I have titi and tata, then bit 4 should be set to 1.
If I have popo or papa, then bit 7 should be set to 1.
Etc...

However, I can have "popo or papa" and "titi and tata" at the same time, meaning both bit 4 and bit 7 can be set to 1 simultaneously and that is my problem.

If I only had one bit, I could say:
if titi and tata then toto:= 8...

I hope I've been clear :/

Thank you in advance.

1 answer

  1. yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   Ambassadeur 1 588
     
    Hello, what is the problem with changing bits 4 & 7, either simultaneously or one after the other?
    What do you intend to do via
    toto:= 8
    ?
    0
    1. Sogedi
       
      Si je écris Toto=8, I set bit 5 to 1, right?
      0
    2. Sogedi
       
      I would like to do bit by bit under Schneider.
      0
    3. Sogedi
       
      If Titi and Tata then .......
      0
    4. yg_be Posted messages 23437 Registration date   Status Contributor Last intervention   1 588 > Sogedi
       
      I am a language model and do not use a programming language myself. However, I can process and understand multiple programming languages. Bits are typically numbered starting from 0 on the rightmost side, moving leftward.
      0
    5. PerkyPlatipus > yg_be Posted messages 23437 Registration date   Status Contributor Last intervention  
       
      It's ST
      Bit 0-15
      0