Eagle_For Posted November 4, 2013 Report Share Posted November 4, 2013 (edited) HelloI seek to recover the value of a power Lvar send it to an offset of FSUIPC. I tried two different ways, namely: 1) function RUN_update(time) dot=ipc.readLvar("L:AB_AP_ALT_Mode") ipc.writreUB(0x66CC, dot) end event.timer(100,"RUN_update") 2) function DOT_ALT_chg ("L:AB_AP_ALT_Mode",dot) dot = ipc.readLvar("L:AB_AP_ALT_Mode") ipc.writeUB(0x66CC,dot)end event.Lvar("L:AB_AP_ALT_Mode",100,"DOT_ALT_chg") but neither of them work Can you tell me what's wrongthank you is an indication here is my script SIOC Var 0020, name OFF_DOT_ALT , Link FSUIPC_IN , offset $66CC , Length 1 It is a Lvar Aerosoft Airbus Extended Merci and excuse my english. Edited November 4, 2013 by Eagle_For Link to comment Share on other sites More sharing options...
spokes2112 Posted November 4, 2013 Report Share Posted November 4, 2013 It looks like version 1 would work correctly by correcting one spelling error, function RUN_update(time) dot=ipc.readLvar("L:AB_AP_ALT_Mode") ipc.writreUB(0x66CC, dot) -- change to write end event.timer(100,"RUN_update") Link to comment Share on other sites More sharing options...
Pete Dowson Posted November 5, 2013 Report Share Posted November 5, 2013 I seek to recover the value of a power Lvar send it to an offset of FSUIPC. I tried two different ways, namely: ... ipc.writreUB(0x66CC, dot) I don't know whether the L:Var name is correct (I don't have that aircraft), but if it is I can see two things wrong: As Roman says, the first example should have "ipc.writeUB" as the function called, not "ipc.writre". The second example shows a little misunderstanding of how a function is defined: function DOT_ALT_chg ("L:AB_AP_ALT_Mode",dot) You cannot provide a constant like ":AB_AP_ALT_Mode" as the name of the parameter to be filled in by the caller. That has to be the name of the variable to receive the name of the LVar. So: function DOT_ALT_chg (name, dot) Okay, you do not use 'name' in the function, but the purpose is to allow one function to handle more than one LVar, so the name then becomes useful. (Sorry, I see the documentation is a little misleading here -- it is expplained in words but the example is poor). The value of that LVar is provided in 'dot', so you don't need to ipc.readLvar in the function at all, it is supplied for you. So this should do it: function DOT_ALT_chg (name,dot) ipc.writeUB(0x66CC,dot) end event.Lvar("L:AB_AP_ALT_Mode",100,"DOT_ALT_chg") The other thing to consider is whether the value returned for the LVar is going to fit adequately in an 8-bit Byte (66CC). Do you know its values? If it is only a 0 or 1, like a switch, then it should be okay, but you need to check. Have you logged its values to see? is an indication here is my script SIOC Var 0020, name OFF_DOT_ALT , Link FSUIPC_IN , offset $66CC , Length 1 I'm afraid I don't know SIOC and cannot comment on whether this is correct. Regards Pete Link to comment Share on other sites More sharing options...
Eagle_For Posted November 6, 2013 Author Report Share Posted November 6, 2013 OK PeteI'll try and I'll let you know.thank you Link to comment Share on other sites More sharing options...
Eagle_For Posted November 7, 2013 Author Report Share Posted November 7, 2013 Hello PeteThank you, this time problem, I recovered the value of the Lvar. :razz: Thank you Raymond Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now