Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    300+ Forum Addict


    brianwilliamson's Avatar
    Join Date
    Oct 2005
    Location
    Gold Coast-AUSTRALIA
    Posts
    455
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Rudder Trim Display in Airbus

    I am trying to get the trim output for the Airbus A321 in FSX to read out on my 4 seven segment digits. With the program I sort of devised !! I have the readouts working in 3 digits but only reading the raw figures which are 0 for the center and 0 to 16384 for the Right and 65537 = (0) to 49153 for Left. There only needs to be one decimal place in the readout which will be fixed. The readout goes from 0 to R20.0 and 0 to L20.0

    For those extremes I am reading on the 3 displays 491 to the Left and 163 to the Right, which are the first 3 digits of the raw figures. The 0 reads 000 which I think I can blank first 2 ok.
    That is where I am in trouble trying to find out how to convert those numbers to read the 0 to 20.0 correctly.
    So I would really appreciate any advice that some of the experts on SIOC can pass on, in this regard.
    Many thanks, regards.....................Brian W.



    //****************************************************************************
    Var 1 Link FSUIPC_INOUT Offset $0C04 Length 2 // RUDDER TRIM VALUE & CONTROL in

    FSUIPC
    {
    v2 = v1 // new value from FSUIPC
    }
    Var 2
    {
    v4 = v2 // write to my 3-digit display
    }
    Var 4 Link IOCARD_DISPLAY Digit 0 Numbers 3 // Display
    //*******************************************************************************
    Attached Images Attached Images

  2. #2
    150+ Forum Groupie


    Perik's Avatar
    Join Date
    Aug 2007
    Location
    NORWAY
    Posts
    193
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    Hello Brian

    Here is a piece of code you could try.
    I've split up the display in single digits and
    I hope you get some ideas from the code. Please adapt to your addressing.
    BTW - Remember the Type 1 in "Link FSUIPC_IN" statement. Makes the conversion a lot easier.

    Code:
    //**************************************************************************
    // $0C04 Rudder trim value/control: –16383 to +16383
    // 16383/X=200, Xmax=81,915, OK so divide by 82 we should be safe.
    // I think displayed number will run from -199 to 199.
    
    Var 1 name TRIM_RAW Link FSUIPC_IN Offset $0C04 Length 2 Type 1 // RUDDER TRIM VALUE & CONTROL in FSUIPC
    
    {
    L0 = ABS &TRIM_RAW   // Get the absolute value
    
    IF &TRIM_RAW < 0       // Check if negative - display (L)eft else display (R)ight
    {
        &D_TRIMSIGN = -999998  // I set minus sign in the fourth display just to verify.
    }
    ELSE      
    {
        &D_TRIMSIGN = -999999  // Else blank the sign position
    }
    
    // Now start to process the trim-value which is stored in L0
    L0 = DIV L0 82     // Now we have max 199 in L0
    L1 = MOD L0 10    // Grab right digit (D_TRIM0)
    &D_TRIM0 = L1     // and write to display 0 ( the decimal number)
    
    L1 = DIV L0 10     // Grab the middle digit (D_TRIM1) 
    &D_TRIM1 = MOD L1 10
      
    L1 = DIV L0 100    // Then get the hundreds
    IF L1 = 0             // Blank if less than 100 or 10.0 in display
    {
        L1 = -999999   // blank
    }
    &D_TRIM2 = L1    // Write the digit.
    }
    
    
    //******************************************************************************* 
    Var 10 name D_TRIM0 Link IOCARD_DISPLAY Device 0 Digit 0 Numbers 1 // decimal digit
    Var 11 name D_TRIM1 Link IOCARD_DISPLAY Device 0 Digit 1 Numbers 1  // next - should also have DP set
    Var 12 name D_TRIM2 Link IOCARD_DISPLAY Device 0 Digit 2 Numbers 1  
    Var 13 name D_TRIMSIGN Link IOCARD_DISPLAY Device 0 Digit 3 Numbers 1 // "L" and "R" or Sign digit
    Regards,
    Per-Erik
    www.hoddo.net

  3. #3
    300+ Forum Addict


    brianwilliamson's Avatar
    Join Date
    Oct 2005
    Location
    Gold Coast-AUSTRALIA
    Posts
    455
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    Per-Erik, Many thanks for that code. Works like a charm. I would have spent weeks trying to figure out how to convert those numbers !!

    I have had the complete IO Cards setup for years on my first build,but changed over to InterfaceIT cards, so was going dispose of the IO Cards. It worked out well for the trim.

    Again many thanks......................Brian W.

  4. #4
    300+ Forum Addict


    brianwilliamson's Avatar
    Join Date
    Oct 2005
    Location
    Gold Coast-AUSTRALIA
    Posts
    455
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    One of the main problems I have is that I do not understand Spanish and most of the instructions to me, leave a lot to be desired.
    Well I have spent the last week trying to figure out how to get the 3 momentary buttons working on the Rudder trim. I have had no trouble getting this type of switch to work in FSUIPC but am at a loss woth SIOC. I have studied that many scripts etc., I think I am going blind !!

    Var 3 Link IOCARD_SW Input 23 Type P
    {
    IF v4 = 0
    {
    v4 = 1
    }
    ELSE
    {
    v4 = 0
    }
    }

    Var 4

    This is a statement that I tried to figure out but as there are no instructions as to what does what and when, I am unable to understand the next move.

    So if anyone can help trying to figure out what I thought would be easy on how to make 3 momentary buttons either send the Rudder SET to 00 and the left and right buttons to change the values for right and left trim I would be extremely grateful. In FSUIPC I have been trying to use $2EC0 with values of 66278 for LEFT and 66379 for Right and 66732 for SET which I presume is 00.

    Many thanks...............Brian W.

  5. #5
    150+ Forum Groupie


    Perik's Avatar
    Join Date
    Aug 2007
    Location
    NORWAY
    Posts
    193
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    Hello Brian.

    Let's see if I can help you out with a few SIOC statements.
    Not sure if RudderTrim works for your A320 as it seems to differ how
    well this is implemented. In the stock A321 (FSX) it seems to work well at least.

    And don’t forget to look here for SIOC examples: http://www.lekseecon.nl/howto.html

    I’m sure the code can be optimized but for test purposes it should do

    Code:
    //*******************************************************************************
    // 
    // 1. Reset Rudder Trim
    // 2. Left and right Rudder Trim 
    // As long as either Left or right momentary switch is pushed
    // the according rudder displacement is adjusted with a rate 
    // of 0,1 (Max deflection is 20) pr. 0,2 second.
    // The rate can easily be modified by the timer values.
    //
    // Reset Rudder
    Var 20 name RUDDER_RESET Link IOCARD_SW Input 38 type P //
    {
    &TRIM_RAW = 0
    } 
    //
    // Left Rudder Trim (decrease rudder trim value)
    //
    Var 21 name RUDDER_LEFT Link IOCARD_SW Input 43 Type I
    {
    IF &RUDDER_LEFT = 1
     {
     &TIMER_RUDDER_L = 0     // Set timer to 0 (startvalue)
     &TIMER_RUDDER_L = TIMER 1000 1 20  // Trigger at each 0,2s and continue 
     }
     ELSE
     {
     &TIMER_RUDDER_L = 999    // Stop timer asap
     }
    }
    Var 30 name TIMER_RUDDER_L
    {
    &TRIM_RAW = &TRIM_RAW - 82
    }
    //
    // Right Rudder Trim (increase rudder trim value)
    //
    Var 22 name RUDDER_RIGHT Link IOCARD_SW Input 62 Type I
    {
    IF &RUDDER_RIGHT = 1
     {
     &TIMER_RUDDER_R = 0
     &TIMER_RUDDER_R = TIMER 1000 1 20  // 0,2 second interval from 0 to 1000
     }
    ELSE
     {
     &TIMER_RUDDER_R = 999   // Stop timer asap
     }
    }
    Var 31 name TIMER_RUDDER_R
    {
    &TRIM_RAW = &TRIM_RAW + 82
    }
    Regards,
    Per-Erik
    www.hoddo.net

  6. #6
    300+ Forum Addict


    brianwilliamson's Avatar
    Join Date
    Oct 2005
    Location
    Gold Coast-AUSTRALIA
    Posts
    455
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    Perik, many thanks again for your great help. I am learning slowly !!

    I had a problem to start wit which turned out to be a bad IDC connector. As soon as I replaced that and did some mods, all ok. I had to change the Link FSUIPC_INOUT, Offset $0C04 which then worked.


    Again you are worth your weight in gold.


    Thanks again......................Brian W.

  7. #7
    300+ Forum Addict


    brianwilliamson's Avatar
    Join Date
    Oct 2005
    Location
    Gold Coast-AUSTRALIA
    Posts
    455
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    Here is a question that one would have thought easy to find the answer, but I am hanged if i can see an answer anywhere.
    Basically I am trying to hook up an output from the leds to drive the Decimal Point, which is stated:

    "The decimal point of a 7-segment display cannot be controlled via the Opencockpits Display card. You do that via an output of the Master card. Just connect an output (WITHOUT A RESISTOR) directly to the DP pin of the 7-segment display (just a single wire, NO GROUND NEEDED) "


    So I put the necessary in to start:

    Var 1 Link IOCARD_OUT Device 1 Output 18 // led


    Then I tried every variation of things that I could find, but no go. Now I thought this would be simple to turn on the power to led 18 to power up the DPoint, but no......


    "Note that you should only assign values 0 or 1 to Var 1. A 1 will imply that the led will lit."

    Var 2
    {
    v1 = 1
    }

    And so-on .......................but no luck.
    Now I think if someone can give me an answer I will feel pretty dumb, but I am exhausted !!!

    Help will be a blessing..............................Brian W.

  8. #8
    150+ Forum Groupie


    Perik's Avatar
    Join Date
    Aug 2007
    Location
    NORWAY
    Posts
    193
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    Brian,

    Try this simple line:

    Var 1 Link IOCARD_OUT Device 1 Output 18 value 1

    It’s an initialization and executes once and Output 18 will stay at 1 as long as
    you do not change it deliberately. Your DP should shine without any further coding.

    If you want to control the activation of DP as well as the displays – for instance
    from Cold&Dark and up, then you need to do a lot more coding.

    The missing part in your short script seems to be that you need something to change v2.
    v1 will never be executed until v2 is changed.
    BTW – I expect you have tested a working DP e.g. from SIOCMonitor.
    Regards,
    Per-Erik
    www.hoddo.net

  9. Likes kiek liked this post
  10. #9
    300+ Forum Addict


    brianwilliamson's Avatar
    Join Date
    Oct 2005
    Location
    Gold Coast-AUSTRALIA
    Posts
    455
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    Thank you again for all your help. I have put in that line , but no luck.

    I have then just put on its own to test:
    Var 2 Link IOCARD_OUT Device 1 Output 18 value 1

    But it will not light up. I have checked on the SIOC Monitor and I can light the decimal point from there ok., but not with the program.

    Of course I can do it the easy way and just run 5V and a resistor to it, but that will not help with solving my learning !

    I will keep fiddling to see if I can spot what I may have done incorrectly.


    Again thanks....................Brian W.

  11. #10
    150+ Forum Groupie


    Perik's Avatar
    Join Date
    Aug 2007
    Location
    NORWAY
    Posts
    193
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rudder Trim Display in Airbus

    Sorry, Brian

    I thought the initialization should work this way as the Sioc compiler
    accepted the Value 1 statment at the end. I didn't test the code though

    The next try will be this: ( still not tested..)


    Code:
    Var 1 name ColdAndDark value 0 // Set the value to current power status
    {
    IF &ColdAndDark = 1
       {
       &RUDDER_DP = 0
       }
    ELSE
       {
       &RUDDER_DP = 1
       }
    }
    
    Var 2 name RUDDER_DP Link IOCARD_OUT Output 18
    Regards,
    Per-Erik
    www.hoddo.net

Page 1 of 2 12 LastLast