Results 1 to 5 of 5

Thread: offset 0D0C

  1. #1
    25+ Posting Member
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    61
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    offset 0D0C

    Hi,
    I hope that there is some that use realbasic and can help me out.
    I'm trying 2 use the offset &H0D0C,2, lights.
    And seems that i'm doing something wrong with the bit's and bytes. the following works.

    if FSUIPC_Write (&H0D0C,2,lights,dwresult) then
    end if


    lights.Byte(0)=1 // nav
    lights.Byte(1)=2 // beacon
    lights.Byte(2)=4 // landing
    lights.Byte(3)=8 // taxi
    lights.Byte(4)=16 // strobe
    lights.Byte(7)=128 // wing
    lights.Byte(=256 // logo
    lights.Byte(9)=512 // cabine

    if kit.getInputState(1)= true then

    lights.Byte(0)=128
    elseif kit.getInputState(1) = false then
    lights.Byte(0)=0
    end if
    but with the (lights.Byte(0)=12i can't use an other bit ex: (lights.Byte(0)=that should be lights.Byte(3)=8
    but when i use

    if kit.getInputState(1)= true then

    lights.Byte(3)=8
    elseif kit.getInputState(1) = false then
    lights.Byte(3)=0
    end if

    or

    if kit.getInputState(1)= true then

    lights.Byte(3)=1
    elseif kit.getInputState(1) = false then
    lights.Byte(3)=0
    end if

    nothing happens

    Hope some can help me out,
    regards,
    Henri

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

    Re: offset 0D0C

    it's solved
    thnx any way.
    regards,
    Henri

  3. #3
    10+ Posting Member
    Join Date
    Feb 2010
    Location
    Denmark
    Posts
    21
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: offset 0D0C

    Hi there Henri,

    I like your head for the thread.....brief to the point. You really have to know what it is about to dig in and read
    ......and it is about FSUIPC and lights.

    I am using RealBasic also because I find the language very easy and readable.
    And, as I can see from your code, also the same interface code to FSUIPC.
    Nice to see other users.

    I am writing a small app to read out some button status to the screen (a narrow column in the right side of the screen)
    It is working perfectly, but I have somme trouble with the status of the lights.
    What I get from offset 0D0C is a number between 0 and 1023. The number indicates which switch is on or off.
    So, I did an Excel spread to find all the combinations. Followed by a Listbox in RealBasic where I can read button status
    depending on the number.
    That works, but the solution is just a work around, because I do not understand the dept of the bits and bytes.

    How did you solve your problem writing the proper byte value (1 or 0) to the right place ?

    Re Peter

  4. #4
    25+ Posting Member
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    61
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Thumbs up Re: offset 0D0C

    Hi Peter,
    sorry it took so long, I have been out for 1 month. I'll get back 2 you with the solution later or 2 morrow.
    regards,
    Henri

  5. #5
    25+ Posting Member
    Join Date
    Jan 2009
    Location
    Belgium
    Posts
    61
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: offset 0D0C

    Hello Peter,
    I hope this will help 2 work with the bit order.

    dim dwresult as integer
    dim n,a, a1,a2,a3,a4,a5 as integer

    if FSUIPC_Write (&H0D0C,2,lights,dwresult) then
    end if
    //lights.Byte(0)=1 // Nav
    //lights.Byte(1)=2 // beacon
    //lights.Byte(2)=4 // landing
    //lights.Byte(3)=8 // taxi
    //lights.Byte(4)=16 // strobe
    //ect

    if FSUIPC_Process (dwresult) then
    if kit.getInputState(1)= true then
    a=1// nav
    else
    a=0
    end if
    if kit.getInputState(2)= true then
    a1=2// beacon
    else
    a1=0
    end if
    if kit.getInputState(3)= true then
    a2=8// taxi
    else
    a2= 0
    end if
    if kit.getInputState(5)= true then
    a3=128 // wing
    else
    a3= 0
    end if
    if kit.getInputState(7)= true then
    a4=256 // logo
    else
    a4=0
    end if

    N= a + a1 + a2 + a3 + a4
    Lights.UInt16Value(0)= N
    end if

    regards,
    Henri

Similar Threads

  1. Offset?
    By Pierre24 in forum PM General Q & A
    Replies: 4
    Last Post: 05-22-2008, 02:32 AM
  2. (A/P-P/RST),(A/T-P/RST),(FMC-P/RST) Offset
    By zirakonium in forum PMSystems
    Replies: 19
    Last Post: 02-21-2008, 02:46 PM
  3. Offset for DF 737-400
    By APAK in forum I/O Interfacing Hardware and Software
    Replies: 0
    Last Post: 09-24-2007, 09:32 AM
  4. QNH offset
    By bindook in forum I/O Interfacing Hardware and Software
    Replies: 2
    Last Post: 03-20-2007, 08:00 AM
  5. Offset again
    By lucas1971 in forum FS2Phidget Users
    Replies: 3
    Last Post: 12-09-2004, 01:49 AM