Results 1 to 5 of 5
  1. #1
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Jan 2014
    Location
    Thailand
    Posts
    9
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Link2fs 6b question

    Hi

    can anyone help me please i want to know in the fsuipc expert function how can i read the bit value. If i want to get value of offset 04F0 bit 3 how can i?
    Thank you in advance for any help.

  2. #2
    25+ Posting Member
    Join Date
    Mar 2014
    Location
    France
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Link2fs 6b question

    Hi mo_nithi,
    simply put a AND logic on your variable with a mask
    3rd bit to test : 0b00000100(binary) = 4(decimal) = 0x4(hexadecimal)
    4th bit to test : 0b00001000(binary) = 8(decimal) = 0x8(hex)
    7th bit to test : 0b01000000(binary) = 64(decimal) = 0x40(hex)
    example
    suppose your value=content of offset 0x04f0 and test 3rd bit of the value

    if((value & 4) == 4) { do what you want if bit=1 } else { do what you want if bit=0}

    hope this help you a little
    ryan

  3. Thanks Mikeb1028 thanked for this post
    Likes Mikeb1028 liked this post
  4. #3
    75+ Posting Member
    Join Date
    Apr 2014
    Location
    Tampa, FL, USA, Earth..umm
    Posts
    77
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Link2fs 6b question

    Quote Originally Posted by Ryan007 View Post
    Hi mo_nithi,
    simply put a AND logic on your variable with a mask
    ...
    suppose your value=content of offset 0x04f0 and test 3rd bit of the value

    if((value & 4) == 4) { do what you want if bit=1 } else { do what you want if bit=0}

    hope this help you a little
    ryan
    Oh! THAT's how you do it. Learn something new everyday. I was wondering that myself. Thanks Ryan!

  5. #4
    25+ Posting Member
    Join Date
    Mar 2014
    Location
    France
    Posts
    27
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Link2fs 6b question

    The solution I gave is more a generic c/c++ solution
    There are many way to do that, and I saw there is something more simple in the arduino reference pages
    if(bitRead(value,2)) { do what you want if 3rd bit of value =1 }
    http://arduino.cc/en/Reference/BitRead

  6. #5
    Our new friend needs to reach 10 posts to get to the next flight level
    Join Date
    Jan 2014
    Location
    Thailand
    Posts
    9
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Link2fs 6b question

    Quote Originally Posted by Ryan007 View Post
    The solution I gave is more a generic c/c++ solution
    There are many way to do that, and I saw there is something more simple in the arduino reference pages
    if(bitRead(value,2)) { do what you want if 3rd bit of value =1 }
    http://arduino.cc/en/Reference/BitRead

    Tried and working now so i got ifly 737 mcp to be working but not finished yet after it is done i will share my code thankyou very for your help