Results 1 to 8 of 8
Thread: Sioc Codeing help
-
11-18-2016, 12:20 AM #1
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Sioc Codeing help
Hi all,
Hope someone can help me correct the following code. Tried everything i understand but no
luck.
What i am trying to do is to have the output to a servo(fuel gauge) read zero when battery
switch is OFF. Here is my code.
Code:Var 0010, name Batswstate, Link FSUIPC_IN, Offset $3102, Length 1 // MASTER BATTERY OFF =0 Var 012, name Fuel, Link FSUIPC_IN, Offset $0B94, Length 4 // Right Tank Percentage { IF V010 = 0 { V014 = 0 } L0 = &Fuel / 8388608 IF L0 < 0.25 { L0 = L2 * 1023 V014 = L1 + 60 } ELSE { V014 = L0 * 1023 } } Var 014, Link USB_SERVOS, Output 2, PosL 0, PosC 512, PosR 1000, Type 2
Regards
Les
-
11-18-2016, 08:00 PM #2
- Join Date
- Feb 2007
- Location
- Argentina
- Posts
- 187
Re: Sioc Codeing help
Les:
With the USB SERVO, the value = 0 is for disconnect servo. (stays in place)
The value depends of the servo to mark 0 in instrumentīs scale.
Try another number (as i see in the SIOC code, must be in the range of 1 to 60)
[
IF V010 = 0
[
V014 = 60 // or value to zero the instrumentīs scale
]
Regards.
Horacio.
-
11-18-2016, 11:19 PM #3
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Re: Sioc Codeing help
Hi Horacio,
Nice to hear from you and thanks for replying. I tried your suggestion and had no luck.
So i changed the code around as follows
Code:Var 0010, name Batswstate, Link FSUIPC_IN, Offset $3102, Length 1 // MASTER BATTERY OFF =0 Var 0012, name Fuel, Link FSUIPC_IN, Offset $0B94, Length 4 // Right Tank Percentage { L0 = &Fuel / 8388608 IF L0 < 0.25 { L0 = L2 * 1023 V0014 = L1 + 60 } ELSE { V0014 = L0 * 1023 } IF &Batswstate = 0 { V0014 = 10 } } Var 0014, Link USB_SERVOS, Output 2, PosL 0, PosC 512, PosR 0
the fuel decreasing.
From my reading on Nico's site he says that " when a variable changes the script
in Curly brackets following is executed" obviously my understanding is wrong.
Cause according to my script its only executed if the fuel quantity is changing.So how does one get a process executed when this varaible
cant change as in my case fuel quantity.
Im utterly confused and no wonder why i can never get much to work .
Anyway your comments and ideas would be appreciated.
Thanks again
Regards
les
-
11-19-2016, 01:38 AM #4
- Join Date
- Feb 2007
- Location
- Argentina
- Posts
- 187
Re: Sioc Codeing help
Les:
Some lines in your code are wrong.
L0 = &Fuel / 8388608
IF L0 < 0.25
{
L0 = L2 * 1023
V0014 = L1 + 60
........
Where is L2 ??????
Anyway, try this way, working on my setup.
Code:Var 0010, name Batswstate, Link FSUIPC_IN, Offset $3102, Length 1 // MASTER BATTERY OFF =0{ L0 = &Fuel / 8388608 IF &Batswstate = 0 { V0014 = 10 } ELSE { IF L0 < 0.25 { L1 = L0 * 1023 V0014 = L1 + 60 } ELSE { V0014 = L0 * 1023 } } } Var 0012, name Fuel, Link FSUIPC_IN, Offset $0B94, Length 4 // Right Tank Percentage Var 0014, Link USB_SERVOS, Output 2, PosL 0, PosC 512, PosR 1023
Sure, there is another way to programming (using subroutines to check Batt status), but i have not sufficient information of your setup.
Regards.
Horacio.
-
11-19-2016, 03:37 AM #5
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Re: Sioc Codeing help
Big Thanks Horacio,
I have yet to try it out on the real gauges but testing SIOC it seems it works
fine.
Will let you know tomorrow when i integrate it with the rest of the code.
Take Care my friend
Regards
Les
-
11-19-2016, 04:37 PM #6
Re: Sioc Codeing help
Hi Guys,
Here a SIOC best practice:
If you want to respond to changes in two other variables, you should put your script in a subroutine and call that subroutine from each of these two variable, like this:
Code:Var 10 name Batswstate Link FSUIPC_IN Offset $3102 Length 1 // MASTER BATTERY OFF =0 { CALL DoSomething } Var 12, name Fuel Link FSUIPC_IN Offset $0B94 Length 4 // Right Tank Percentage { CALL DoSomething } Var 9000 Link SUBRUTINE name DoSomething { // here the SIOC code that uses Batswstate and Fuel to calculate the output to the Servo }
Nico Kaan SIOC / How to programLast edited by kiek; 11-19-2016 at 04:44 PM.
-
11-19-2016, 11:05 PM #7
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Re: Sioc Codeing help
Hi Nico,
Thanks for your comments and appreciate your guidance and i try to use your procedure when i can and will experiment so i can increase my skill level with sioc.
Horacio: Everything worked like a dream, so thanks again.
Kindest Regards
Les
P.S Had a wee go using Nico's advice and it worked great. I have stored that imformation for later
-
11-20-2016, 12:19 AM #8
- Join Date
- Feb 2007
- Location
- Argentina
- Posts
- 187
Re: Sioc Codeing help
Nico: Thatīs the way.... Thanks
Les: Youīre welcome.
Keep in touch.
Regards.
Horacio.
CHILDREN ONION SITES PARADISE BIRDS CLIPS : ( )...
P T H C FILES CLOUD TANGO VIDEOS...