PDA

View Full Version : offset 0D0C



henri
03-04-2010, 06:21 AM
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(8)=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)=128)i can't use an other bit ex: (lights.Byte(0)=8)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
:(

henri
03-05-2010, 01:47 PM
it's solved
thnx any way.
regards,
Henri

peterthisted
03-18-2010, 06:13 AM
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

henri
04-04-2010, 07:28 AM
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

henri
04-05-2010, 05:00 AM
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