Results 1 to 7 of 7
-
04-01-2016, 02:20 PM #1
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Reversing Servo direction with Sioc
Hi All,
Found some code for my Turn Coordinator that works. However its direction is reversed. I know i could dismantle
the servo and reverse the pot and motor. But i understand it can be done in Sioc.
Here is the code and can someone tell me how to enclose my code in a seperate window.
Var 0000, name Startup, Value 1 // Initialization
{
&TurnRateservo = 593
}
Var 0004, name TurnRateservo, Link USB_SERVOS, Output 2, PosL 163, PosC 593, PosR 1022 // Turn Rate Ind
Var 0013, name TurnRate, Link FSUIPC_IN, Offset $037C, Length 2
{
C0 = TESTBIT &TurnRate ,15
IF C0
{
L1 = 65536 - &TurnRate
L0 = L1 * 0.2
}
ELSE
{
L0 = &TurnRate * -0.2
}
L0 = L0 + 593
C0 = L0 < 370
C1 = L0 > 675
IF C0
{
L0 = 370
}
ELSE
{
&TurnRateservo = L0
}
IF C1
{
L0 = 675
}
ELSE
{
&TurnRateservo = L0
}
}
Thanks
Les
-
04-01-2016, 02:50 PM #2
- Join Date
- Feb 2007
- Location
- Argentina
- Posts
- 187
Re: Reversing Servo direction with Sioc
Les:
You just have to multiply by -1 somewhere........
Just change (the red part) and try:
........
L1 = 65536 - &TurnRate
L0 = L1 * -0.2
}
ELSE
{
L0 = &TurnRate * 0.2
}
...........
Complete revisited code:
Var 0000, name Startup, Value 1 // Initialization
{
&TurnRateservo = 593
}
Var 0004, name TurnRateservo, Link USB_SERVOS, Output 2, PosL 163, PosC 593, PosR 1022 // Turn Rate Ind
Var 0013, name TurnRate, Link FSUIPC_IN, Offset $037C, Length 2
{
C0 = TESTBIT &TurnRate ,15
IF C0
{
L1 = 65536 - &TurnRate
L0 = L1 * -0.2
}
ELSE
{
L0 = &TurnRate * 0.2
}
L0 = L0 + 593
C0 = L0 < 370
C1 = L0 > 675
IF C0
{
L0 = 370
}
ELSE
{
&TurnRateservo = L0
}
IF C1
{
L0 = 675
}
ELSE
{
&TurnRateservo = L0
}
}
Regards.
Horacio
-
04-01-2016, 03:32 PM #3
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Re: Reversing Servo direction with Sioc
Thanks Horacio,
The software developer says all you need to do was &TurnRateservo = 1023 - FINAL_VALUE_SERVO. That then screwed up
my centre value but did reverse it. Readjusted my L1 + 593 and this brought back the center correctly and then it stopped
turning at 2min in one direction only. I think my problem here maybe to do with the values set in C0 = L0 < 370 and
C1 = L0 > 675.
i ran out of time yesterday so will play with those values to day.
Thanks
Regards
Les
-
04-02-2016, 03:38 PM #4
- Join Date
- Feb 2007
- Location
- Argentina
- Posts
- 187
Re: Reversing Servo direction with Sioc
Hi Les:
As i say in yours other topic (Real Airspeed Gauge Sioc Script Problems), changing one value can screw up all script.
Reversing servo turn is simple as multiply by -1 in some place.
Some servos do not work in all values (0-1023).
So, check first the limits of your servo, check the the value of center position. and make some calculations based in the instructions of the referred topic.
Regards.
Horacio.
-
04-04-2016, 03:45 AM #5
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Re: Reversing Servo direction with Sioc
Thanks Horacio,
I took the suggestion from the software developer of SIOC and did this,
1023 - FINAL_VALUE_SERVO and it worked both times i used it.
Horacio there is one part of SIOC that i fail to see it working.
This is the line "PosL 163, PosC 593, PosR 1022
From what i could take from the description it is supposed to limit the range the Servo makes.
From my own experience i have never seen it limit the range of the servo. I have had to put limits
into my Sioc code.
So do you know exactly what it is supposed to do?.
Thnaks
Kindest Regards
Les
-
04-05-2016, 09:51 PM #6
- Join Date
- Feb 2007
- Location
- Argentina
- Posts
- 187
Re: Reversing Servo direction with Sioc
Les:
Short of time to make some tests now.
Give me some days, and I'll give you an answer to your question about meaning of those limits and what is supposed to do.
Regards.
Horacio.
-
04-06-2016, 02:39 PM #7
- Join Date
- Jan 2007
- Location
- NEW ZEALAND
- Posts
- 899
Re: Reversing Servo direction with Sioc
Horacio,
No hurry as it just a curiosity.
Les
Pretty Girls from your city for night
New Version of UPDNAV for Jeehell...