Results 1 to 2 of 2
Thread: encoder in SIOC
-
10-08-2009, 07:26 AM #1
- Join Date
- Aug 2009
- Location
- Netherlands
- Posts
- 18
encoder in SIOC
Hi again,
David helped me out with my problem showing heading on my sim-avionics.
Now I have the following problem:
I have a SIOC script to change my heading.
The goal of this script is only to change the heading bug on my virtual cockpit in FSX.
I have a CTS288 grey encoder from opencockpits, connected on the mastercard inputs 3 and 4 (and gnd off course)
When I look at the Controlador software, and turn the encoder I see:
RIGHT: 004 -> 003-004 -> 003 -> empty
LEFT: 003 -> 003-004 -> 004 -> empty
I think that is good?!
My script is:
Code:Var 1, name X_HDG, Link FSUIPC_INOUT, Offset $07CC, Length 2 { // convert from fsuipc range to degrees: L0 = DIV &X_HDG, 182 IF &HDG != L0 { &HDG = L0 } } Var 2, name HDG { CALL &OutHDG } Var 3, name OutHDG, Link SUBRUTINE { // convert from degrees to fsuipc range: L0 = &HDG * 182 IF &X_HDG != L0 { &X_HDG = L0 } } Var 4, name RO_HDG, Link IOCARD_ENCODER, Input 3, Aceleration 4 Type 2 { L0 = &RO_HDG // * -1 turning right should be plus &HDG = ROTATE 0, 359, L0 }
I see the heading bug move one degree to the right and immediately one to the left (for example 342 and instantly 341 again).
When I turn the encoder fast, it moves to the right, but very shaking and nog very well.
I changed the input number to 1 (that is my altitude encoder), the same happens, So I don't think it is a problem with the encoder.
Is there something wrong with my code?
Thanks again,
Steef
-
10-08-2009, 07:42 AM #2
- Join Date
- Aug 2009
- Location
- Netherlands
- Posts
- 18
Re: encoder in SIOC
I was looking for the solution for about two days now..
Kept looking and found the solution!!
On: http://www.kennair.com.au/downloads/SIOC/Pedestal.txt
I now have the code cut from this:
Code:Var 2000, Value 0 // Initialization { &D_HDG = 360 } Var 2004, Link FSUIPC_INOUT, Offset $07C8, Length 4 // AP_HDG_SEL { IF V2004 = 1 { &O_HDGSEL = 1 } ELSE { &O_HDGSEL = 0 } } Var 2005, name APD_HDG, Link FSUIPC_INOUT, Offset $07CC, Length 2 // APD_HDG Var 2104, name D_HDG, Link IOCARD_DISPLAY, DEVICE 1, Digit 6, Numbers 3 { L1 = &D_HDG * 182.04444 L0 = L1 + 1 &APD_HDG = L0 } Var 2212, name O_HDGSEL, Link IOCARD_OUT, DEVICE 1, Output 26 Var 2306, name E_HDG, Link IOCARD_ENCODER, Input 3, Aceleration 4, Type 2 { L0 = &E_HDG // * -1 &D_HDG = ROTATE 1, 360, L0 } Var 2426, name I_HDGSEL, Link IOCARD_SW, DEVICE 1, Input 28 { IF &I_HDGSEL = 1 { IF V2004 <> 1 { V2004 = 1 } ELSE { V2004 = 0 } } }
Maybe I can help soneone with this, thanks anyway
Similar Threads
-
Encoder Help
By CessnaGuy in forum General Aviation (GA) Builder DisccusionReplies: 5Last Post: 04-20-2011, 05:03 AM -
Dual Rotary Encoder in SIOC
By 737dragon in forum OpenCockpits General DiscussionReplies: 0Last Post: 09-13-2010, 05:01 AM -
Turning a Rotary encoder with a pushbutton into a dual rotary encoder
By snizbatch in forum I/O Interfacing Hardware and SoftwareReplies: 2Last Post: 05-11-2009, 02:57 AM -
Encoder
By Andras in forum FS2Phidget UsersReplies: 5Last Post: 12-13-2004, 08:03 PM
Search Prettys Womans from your city for night
5.Sharing an Essay about PIC16F877