Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1
    25+ Posting Member
    Join Date
    May 2008
    Location
    Perth
    Posts
    40
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Rotary Encoder Steps

    Hi Nico,
    I have never been able to sort this out and am seeking your advice.
    I have the OC comm cards with 6 digits and the code has been working reliably but I would like to improve the frequency steps I get from the rotary encoders if this is possible. Tuning the frequencies on both the big knob and the small knob has never been smooth. What I mean is that the big knob will jump two numbers even when turning slowly. and the small knob jumps 10 to 15kHz steps, (a bit erratic) is slow to tune on the new frequency.
    Ideally the Big Knob will tune 1 MHz in one step and the small knob in 25kHz steps. Can this be achieved?
    Please see the code below for the rotary encoders.

    // rotary encoders


    Var 3691 Static name BigFreqL Link IOCARD_ENCODER Device 1 Input 0 Aceleration 1 Type 2
    Var 3692 Static name SmallFreqL Link IOCARD_ENCODER Device 1 Input 4 Aceleration 1 Type 2

    Regards
    Greg

  2. #2
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Hi Greg,
    That sounds strange... If you turn the encoder just one click it should result in a 1 unit in- or decrease in PSX. At least that's what is happening over here. I'm using gray type rotary encoders with 1/4 cycle per detent and 16 detents/revolution. That is very important. However, I'd think that Opencockpits would use these in their modules too... ?? Could you check that?

    The encoders for the communication modules are designed in PSXseecon such that if you turn slowly they will change 1 unit and if you turn faster they will change more units. I could add encoders that always increase 1 unit no matter how fast you turn, but then it will take a lot of time to dial a far-off frequency.

    One better use the right hardware encoder.

    Regards,
    Nico
    Last edited by kiek; 06-21-2015 at 06:18 PM.

  3. #3
    25+ Posting Member
    Join Date
    May 2008
    Location
    Perth
    Posts
    40
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Hi Nico, I was never able to resolve this problem, non the less, we managed WorldFlight with the tuning of the smallfreq knob being slow and a bit erratic. I have just pulled the OC module out of the sim, now can respond to some of your questions. It would be great to sort this out.

    Just putting the OC Com module on the bench and running IOCmodules.exe it runs perfect, the tuning is fast and responsive. The small freq knob steps in 25khz reliably and thats why it tunes fast.
    Connected to PSX through psxseecon is the problem the the counts are slow and erratic.

    "If you turn the encoder just one click it should result in a 1 unit in- or decrease in PSX."
    PSX is stepping in 5khz steps, and that is the normal psx step. (also a bit erratic, sometime jumps 10khz)
    The encoders used in the OC module is Bournes ECWOJ-B24-AC0006, 2 bit quadrature, 24 clicks/turn

    "
    The encoders for the communication modules are designed in PSXseecon such that if you turn slowly they will change 1 unit and if you turn faster they will change more units. I could add encoders that always increase 1 unit no matter how fast you turn, but then it will take a lot of time to dial a far-off frequency."
    If I turn the frequency knob fast, then the count almost stops, as if the count steps are too fast to be seen in the software. Me thinks this is the root cause of the problem, that the steps (when you turn the knob fast) are not being sent through to psx.

    I do not have any OC encoder cards, so the option to set this up like you have with the encoder connected to an OC card is not possible.

    Congrats on your Psxseecon Traffic software, very cool idea. Your contribution to PSX and helping me out is much appreciated.
    Am I the only guy using OC modules with PSX? It would be interesting to know if I am the only one with this issue.
    Regards
    Greg

  4. #4
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Hi Grag,
    Could you post the SIOC code you are using for the OC Comm module?

    Quote Originally Posted by gregh View Post
    I do not have any OC encoder cards, so the option to set this up like you have with the encoder connected to an OC card is not possible.
    I do not use a OC encoder card.... I connect an encoder directly to two Opencockpits Master card inputs. That's by far the best solution. Juts make sure you have the right type of encoder.

    Quote Originally Posted by gregh View Post
    Am I the only guy using OC modules with PSX? It would be interesting to know if I am the only one with this issue.
    There are not many that I'm aware off. But in Perth Australia you may find Blake (see the PSX forum) who is using many OC cards for his cockpit and in France there's Jean-Philippe (JP744) who has built a full cockpit with OC cards. And then there is myself of-course.

    Regards,
    Nico

  5. #5
    25+ Posting Member
    Join Date
    May 2008
    Location
    Perth
    Posts
    40
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Hi Nico, Thanks for your reply.
    I think my next step is to wireshark the Qcodes to see if they are being sent.
    I assume that a Qcode step should be sent for every click on the rotary encoder and can check that if I spin the dial fast that a a string of Qcodes are being sent.


    Quote Originally Posted by kiek View Post
    Hi Greg,
    Could you post the SIOC code you are using for the OC Comm module?
    ///////////////////////////////////////////////////////////////////////////
    //
    // Title: PSX RCP Right
    // Note: Numeric values only (VHF: 123.456 or HF 12.3456)
    //
    // psxseecon
    // version: 1.0.20
    //
    // Date: 6 Oct 2014
    //
    // Author: Nico Kaan
    // The Netherlands
    // www.lekseecon.nl
    //
    // ************************************************************************


    // rotary encoders


    Var 3697 Static name BigFreqR Link IOCARD_ENCODER Device 2 Input 0 Aceleration 1 Type 2
    Var 3698 Static name SmallFreqR Link IOCARD_ENCODER Device 2 Input 4 Aceleration 1 Type 2


    // active standby toggle


    Var 3627 Static Link IOCARD_SW Device 2 Input 6 Type P


    // Indicator lights


    // Var 2094 Static name IndsRcpR
    // {
    //&O_VhfR_Li = TESTBIT &IndsRcpR 20


    // and so on for the other lights ...


    // }


    Var 3026 Static name RcpRa
    {
    CALL &DecBCD6 &RcpRa
    &D_VhfR_A0 = &Digit0
    &D_VhfR_A1 = &Digit1 // note I have only a 5 digits display, so I skip Digit0
    &D_VhfR_A2 = &Digit2 // But Greg Has 6!
    &D_VhfR_A3 = &Digit3
    &D_VhfR_A4 = &Digit4
    &D_VhfR_A5 = &Digit5
    &O_DPVhfR_A = TESTBIT &RcpRa 24
    // &O_DPHfR_A = TESTBIT &RcpRa 25
    }


    Var 3027 Static name RcpRs
    {
    CALL &DecBCD6 &RcpRs
    &D_VhfR_S0 = &Digit0
    &D_VhfR_S1 = &Digit1 // note I have only a 5 digits display, so I skip Digit0
    &D_VhfR_S2 = &Digit2
    &D_VhfR_S3 = &Digit3
    &D_VhfR_S4 = &Digit4
    &D_VhfR_S5 = &Digit5
    &O_DPVhfR_S = TESTBIT &RcpRs 24
    // &O_DPHfR_S = TESTBIT &RcpRs 25
    }




    Var 9020 name D_VhfR_A0 Link IOCARD_DISPLAY Device 2 Digit 0 Numbers 1
    Var 9021 name D_VhfR_A1 Link IOCARD_DISPLAY Device 2 Digit 1 Numbers 1
    Var 9022 name D_VhfR_A2 Link IOCARD_DISPLAY Device 2 Digit 2 Numbers 1
    Var 9023 name D_VhfR_A3 Link IOCARD_DISPLAY Device 2 Digit 3 Numbers 1
    Var 9024 name D_VhfR_A4 Link IOCARD_DISPLAY Device 2 Digit 4 Numbers 1
    Var 9025 name D_VhfR_A5 Link IOCARD_DISPLAY Device 2 Digit 5 Numbers 1




    Var 9026 name D_VhfR_S0 Link IOCARD_DISPLAY Device 2 Digit 6 Numbers 1
    Var 9027 name D_VhfR_S1 Link IOCARD_DISPLAY Device 2 Digit 7 Numbers 1
    Var 9028 name D_VhfR_S2 Link IOCARD_DISPLAY Device 2 Digit 8 Numbers 1
    Var 9029 name D_VhfR_S3 Link IOCARD_DISPLAY Device 2 Digit 9 Numbers 1
    Var 9030 name D_VhfR_S4 Link IOCARD_DISPLAY Device 2 Digit 10 Numbers 1
    Var 9031 name D_VhfR_S5 Link IOCARD_DISPLAY Device 2 Digit 11 Numbers 1

    // Var 9032 name O_VhfR_Ri Link IOCARD_OUT Device 2 Output 35
    Var 9033 name O_DPVhfR_A Link IOCARD_OUT Device 2 Output 20
    Var 9034 name O_DPVhfR_S Link IOCARD_OUT Device 2 Output 21
    // Var 9014 name O_DPHfR_S Link IOCARD_OUT Device 2 Output ?? // don't have this yet
    // Var 9015 name O_DPHffR_A Link IOCARD_OUT Device 2 Output ?? // ,,


    // eof
    ///////////////////////////////////////////////////////////////////////////



    [/QUOTE]
    There are not many that I'm aware off. But in Perth Australia you may find Blake (see the PSX forum) who is using many OC cards for his cockpit and in France there's Jean-Philippe (JP744) who has built a full cockpit with OC cards. And then there is myself of-course.
    Blake uses OC cards, but FDS radio modules.

    Regards,
    Nico[/QUOTE]

  6. #6
    25+ Posting Member
    Join Date
    May 2008
    Location
    Perth
    Posts
    40
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Further info. Wireshark info.
    The software seems to be sending the Qcodes ok.
    Here is the result of a quick turn of the small freq knob.
    Time 2.3445 Qs111=0;0;1 sent 12 times on one packet.
    Time 2.5455 Qs111=0;0;1 sent 14 times in one packet
    Time 2.7455 Qs111=0;0;1 sent 4 times in one packet

    I think it is reasonable to think that a quick twist on the small freq knob would result in 30 or so clicks. Hence Qs111 being sent 30 times.
    So now I think it could be a problem with PSX not being able to buffer and respond to the same code sent multiple times in one string? Because the actual frequency hardly moved.


    Hope that helps.

  7. #7
    25+ Posting Member
    Join Date
    May 2008
    Location
    Perth
    Posts
    40
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Hi Nico,
    I appears the problem is with Qs111=0;0;1 being sent multiple times in one string.
    This is not how Hardy recommends it should be done.
    For larger steps the code should be up to Qs111=0;0;8 for 8 steps in one data packet.
    It appears that psxseecon is only sending 1 step at a time.
    Also if there is lots of Qs111=0:0:1 together in one string it will only step once.
    Greg
    "There are three values sperarated by semicolons; one rotation event value for each infinite rotary selector. There is no semicolon at the end. The values can be non-zero only momentarily. When the server receives a non-zero injection, the server reads it and then resets the value to zero. The zero is not returned to the network. The values from left to right: HF sens knob, big frequency knob, small frequency knob. A one-click rotation on the hardware should be injected into the server by -1 (left turn) or 1 (right turn). A quick, great rotation event should typically send -8 or 8. Rotation events should be injected at a rate not higher than 20 Hz."

  8. #8
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Hi Greg,
    Code:
    Var 3698 Static name SmallFreqR Link IOCARD_ENCODER Device 2 Input 4 Aceleration 1 Type 2 
    

    I think that if you would use higher Aceleration values (say 4), you will get larger steps in Qs111....
    Cheers,
    Nico




  9. #9
    25+ Posting Member
    Join Date
    May 2008
    Location
    Perth
    Posts
    40
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Quote Originally Posted by kiek View Post
    Hi Greg,
    I think that if you would use higher Aceleration values (say 4), you will get larger steps in Qs111....
    Correct, I wiresharked the Q codes and yes the code is now Qs111=0;0;8 ect

    But the effect is still the same in PSX. Slow movement. (but is bit better by turning the knob slow, the faster you turn it the slower the steps)

    I tested PSX by sending this from Visual Basic and sent this code string....."Qs111=0;0;8 & crlf & Qs111=0;0;8 & crlf & Qs111=0;0;8 & crlf & Qs111=0;0:8 & crlf Qs111=0;0;8 & crlf & Qs111=0;0;8 & crlf & Qs111=0;0;8 & crlf "

    PSX only stepped 8times once.
    PSX does not recognise mutiple steps in one packet.
    Reading Hardys notes:
    Rotation events should be injected at a rate not higher than 20 Hz."

    Thanks for your help.

    Greg

  10. #10
    2000+ Poster - Never Leaves the Sim kiek's Avatar
    Join Date
    Jan 2007
    Location
    Netherlands
    Posts
    2,202
    Contribute If you enjoy reading the
    content here, click the below
    image to support MyCockpit site.
    Click Here To Contribute To Our Site

    Re: Rotary Encoder Steps

    Hi Greg,
    Quote Originally Posted by gregh View Post

    Thanks for your help.
    Thanks for your feed back, very helpful.

    Quote Originally Posted by gregh View Post
    Rotation events should be injected at a rate not higher than 20 Hz
    PSXseecon injects data into PSX at a rate of 5Hz. However, in these data more then one Qs111 can occur. It looks like that is the problem. Do you agree?

    If so, I'll think off how to change PSXseecon.

    Nico

Page 1 of 2 12 LastLast