December 8, 200619 yr Author >That would be great indeed. But e.g. in the lcd software now>I just give a var as a number. Else they would have to make>it a text box. It's doable but they'd have to do changes to>everything .. not just sioc.Not really. What I do with my piece of perl script, I keep the key-emulator etc variables defined first, so I know which numbers they get.//T
December 23, 200619 yr Hello,Nico wrote some example code were he shows how SIOC can both read and write using the example of a MCP heading Display. Its very interesting because you can change your 7 segment display using either your encoder OR a mouse ( with the fs2004 airplane panel).When I DONT use the read and write code, my encoder turns very smooth with the display, but when I use the code below, my encoder and display become very jumpy and doesnt work so well (jumpy, and not smooth).I have played with the encoder acceleration values ( even though It runs great when not reading, only writing), but this didnt seem to help any.Has anybody seen this, and/or have a fix for this issue?Here is the code that I refer to;/////////////////////////////////////////////////////////////////////////////// SIOC: How to read (Display) and write (change) a// FSUIPC read/write variable//// The example details the AP HDG but other// application area's are: AP SPD, VS, ALT// VOR freq and CRS// HF radio freq and CRS// ILS freq and CRS// ... and so on//// Note that your hardware and the sim are// always synchronised, whether you are using the// mouse or the rotarie.////// May 19, 2006//// Nico Kaan// The Netherlands// www.nicokaan.nl// email: [email protected]//////Var 1, name X_HDG, Link FSUIPC_INOUT, Offset $07CC, Length 2{// convert from fsuipc range to degrees:L0 = DIV &X_HDG, 182IF &HDG != L0{&HDG = L0}}Var 2, name HDG{CALL &OutHDG}Var 3, name OutHDG, Link SUBRUTINE{&D_HDG = &HDG// convert from degrees to fsuipc range:L0 = &HDG * 182IF &X_HDG != L0{&X_HDG = L0}}Var 4, name RO_HDG, Link IOCARD_ENCODER, Input 36, Aceleration 4 Type 2{L0 = &RO_HDG // * -1 turning right should be plus&HDG = ROTATE 0, 359, L0}Var 5, name D_HDG, Link IOCARD_DISPLAY, Digit 0, Numbers 3Thanks,Polmer
December 23, 200619 yr Hi Polmer,Are you sure you have set the refresh FSUIPC rate in SIOC.INI fast enough? Say 60 milli secs?I know quite a lot of people that have implemented this coding principle for their Level-D MCP. Have not heard complaints like this sofar.Rgrds,Nicohttp://www.nicokaan.nl
December 23, 200619 yr Author One thing that might happen is that you accidentally create an event loop - this could affect performance a lot. I mean, when A changes, change B. When B changes, change A..//T
December 23, 200619 yr >One thing that might happen is that you accidentally create>an event loop - this could affect performance a lot. I mean,>when A changes, change B. When B changes, change A..>Hi Tuomas,I don't think so because that's taken care of with the IF statements...The only thing I thesedays do diffrently from the time I wrote this example, is to use <> instead of != for testing for 'not equal', but that is only a syntax change. However, still worth trying.Merry ChristmasNicohttp://www.nicokaan.nl
December 23, 200619 yr Well,my FSUIPC refresh rate ( in the SIOC .ini) was set at 60, so this doesnt seem to be the issue.The strange thing is that, when I use your Level-D MCP code ( which also reads and writes) every thing works smoothly too.But since I am trying to write code for a Generic fs2004 plane, I had to refer to fsuipc offsets, and thats when things get all jittery.I tried to test the most basic example I could find to eliminate any errors and just used the heading code, but that even by itself doesnt work smoothly (at lease on my system) for some reason.I will keep trying differnt things, but am running out of ideas why it works for the level D offsets, but not for the generic fs2004 ones.I will change the syntax as well and see if that helps."The only thing I thesedays do diffrently from the time I wrote this example, is to use <> instead of != for testing for 'not equal', but that is only a syntax change. However, still worth trying."Polmer
December 23, 200619 yr >I will keep trying differnt things, but am running out of>ideas why it works for the level D offsets, but not for the>generic fs2004 ones.Well the Level-D offsets are provided by my FSCONV program. In there I keep track whether changes in a value are caused by a changing rotary or by a change in the simulator panel (by mouse). Therefore I know whether to write back a value or not, and so I prevent unneccesary operations or even loops. About the same tactics as you see in the SIOC code with the IF <> statements.I assume that FSUIPC will do something similar ... but ofcourse I do not know that for sure. If not, it could be the cause of the problems you mention (and what Tuomas has brought forward too), but it's only merely guessing.I'm curious for your latest results.Nicohttp://www.nicokaan.nl
December 24, 200619 yr Hi Polmer,I have tried that piece of code myself (again), and it ran smoothly (generic 737-300). However, there is a small difference (1 degree) between the panel and the hardware display. I think that might be caused by a rounding error by using 182 instead of 65536 / 360 which is actually 182.044444444444You could try to improve the program in that respect, but beware of arithmetic overflows.Nicohttp://www.nicokaan.nl
December 24, 200619 yr Thanks for looking into it Nico,I Find it interesting that it works fine for you ( except for being 1 value off). For me , it is also sending 1 number too high but then it flutters and then goes back down to the correct value. for instance;If I am at heading 100 and turn the encoder 1 click to the right, both the 7 segment display and my fs panel show 102 for a brief moment,then it flutters and then goes to 101. it is as though the encoder it sending a value of 1.4 for each turn rather than 1 , so the result is a fluttering diplay.I will play with the different rounding value and see if that help at all. Not sure what a "arithmetic overflow" is, but I guess I will know if I create one. Merry Christmas/ Happy New Year!Polmer
December 25, 200619 yr I discovered that I had inadvertly used 182 rather than 182.04444 for the heading diplay and now it works much better.For some reason, there is still a brief delay when turning the encoder, but this is something I can live with. Thanks,Polmer
December 28, 200619 yr Nico,I too finally got the generic heading offset to work smoothly, but also got 1 degree of disagreement between my 7-segment and the FS panel.I then loaded another panel ( project opensky), and did not see any error at all. Same with the default FSX panels. This Problem seemed to be localized to the default fs2004 panels (for some reason).After trying many things, I finally got it to work on the Default fs2004 panels. The meat of the change is that it uses the equation; 65536/359, rather than 65536/360. I am very new to writing code, but here is a messy version I got to work with Default fs2004 panels, in Sync and no fluttering;Code for Default fs2004 heading with read and write capabilites;=========================================================Var 0600, Link IOCARD_DISPLAY, Digit 0, Numbers 3Var 0500, Link IOCARD_ENCODER, Input 6, Aceleration 6, Type 2{ L0 = V0500 * 1 V0900 = ROTATE 0 ,359 ,L0}Var 0005, Link FSUIPC_OUT, Offset $07CC, Length 2Var 0305, Link SUBRUTINE{ V0600 = V0900 L0 = V0900 * 182.55153203 IF V0005 <> L0 { V0005 = L0 }}Var 0800, Link FSUIPC_IN, Offset $07CC, Length 2{ L0 = V0800 / 182.55153203 L0 = L0 IF V0900 <> L0 { V0900 = L0 }}Var 0900 // 900{ CALL V0305}For FSX, this code both Read and writes=====================================================================Var 0600, Link IOCARD_DISPLAY, Digit 0, Numbers 3Var 0500, Link IOCARD_ENCODER, Input 6, Aceleration 6, Type 2{ L0 = V0500 * 1 V0900 = ROTATE 1 ,360 ,L0}Var 0005, Link FSUIPC_OUT, Offset $07CC, Length 2Var 0305, Link SUBRUTINE{ V0600 = V0900 L0 = V0900 * 182.0444444 IF V0005 <> L0 { V0005 = L0 }}Var 0800, Link FSUIPC_IN, Offset $07CC, Length 2{ L0 = V0800 / 182.0444444 L0 = L0 IF V0900 <> L0 { V0900 = L0 }}Var 0900 // 900{ CALL V0305}Polmer
December 30, 200619 yr Hi,I have compiled a few power point slides about the Simple use of SIOC (to start with ... ). Might give some guidance.You can find it in the SIOC section at the IOcards page of my web site.Happy New Year!Regards,Nicohttp://www.nicokaan.nl
January 16, 200719 yr Gentlemen ,Do I have to know the offset of every disply ?For instace , in the plane I fly I don't know the offset for AP Altitude and AP VS , so I still can use SIOC for display the Altitude and VS ?Thanks and regardsAlberto Kunzel
January 16, 200719 yr >Gentlemen ,>>Do I have to know the offset of every disply ?>>For instace , in the plane I fly I don't know the offset for>AP Altitude and AP VS , so I still can use SIOC for display>the Altitude and VS ?>Could you be a little more specific, I don't understand.In general: SIOC cannot display values it has no access too... (like any other system)Nicohttp://www.nicokaan.nl
January 16, 200719 yr >>Gentlemen ,>>>>Do I have to know the offset of every disply ?>>>>For instace , in the plane I fly I don't know the offset for>>AP Altitude and AP VS , so I still can use SIOC for display>>the Altitude and VS ?>>>Could you be a little more specific, I don't understand.>In general: SIOC cannot display values it has no access too...>>(like any other system)>>Nico>http://www.nicokaan.nlHi Nico ,I use DF737-400 , and for AP Altitude and AP VS I don't know what is their offsets , I could not get this from DF specialists , those offsets are different from the default MS 737.So ,still will be posible to use SIOC to display the Altitude and VS without to know them ?RegardsAlberto Kunzel
Create an account or sign in to comment