Results 11 to 19 of 19
-
01-22-2011, 02:56 AM #11
Re: Nico's Kaan NAV1 & Course example
Hi Samsail
Tanks for the code, it suizid be done with a single encoder. But at the moment my time is very limited.
Writing sioc is not that hard. I always said to myself i can't learn it. I spend lots of money on other elektronics because sioc is so hard. Than one week I said now you have to learn how. Took lots of examples made Lots of mistakes, but now i am ok with it. And there are lots of people out there that will help you have problems.
Don't give up have lots of fun here.
Cheers Norbert
-
01-22-2011, 02:25 PM #12
Re: Nico's Kaan NAV1 & Course example
That's already available at my website: SIOC code for ADF
regards,
Nico
-
01-23-2011, 07:33 AM #13
Re: Nico's Kaan NAV1 & Course example
Hi Nico
Will have a look at it later. Thanks
Cheers Norbert
-
01-27-2011, 11:33 PM #14
- Join Date
- Aug 2010
- Location
- Greece
- Posts
- 5
Re: Nico's Kaan NAV1 & Course example
Hi,
Here is my progress in SIOC code.
In the attached file “Radio NAV1 NAV2”
I wrote a script to control NAV1 And NAV2 Radio freq. using a single rotary encoder with push button for Hi and Low frequencies, plus two more push buttons, one to select NAV1 or NAV2 and one to Swap form standby mode to active mode.
I thank you Nico for your examples, these are a great help for me.
In the attached file “ Nico’s ADF1” I have try to modify your script for the ADF1 in case to use one rotary encoder with push a button, but it is not work.
Can you please Nico check this file for my mistakes?
I thank you in advance,
Yiannis
-
01-28-2011, 08:42 AM #15
Re: Nico's Kaan NAV1 & Course example
Here a version in which I've corrected your mistakes ... Also check the input number of your PushButton
Nico
Code:Var 8700 name X_ADF1High Link FSUIPC_INOUT Offset $034C Length 2 { L0 = FROMBCD &X_ADF1High IF &ADF1High <> L0 // block values coming from rotary { &ADF1High = L0 &ADF1HighR = DIV &ADF1High 10 CALL &CalcADF1LowR CALL &CalcADF1Freq } } Var 8701 name X_ADF1Low Link FSUIPC_INOUT Offset $0356 Length 2 { IF &X_ADF1Low <> &ADF1Low // block values coming from rotary { &ADF1Low = &X_ADF1Low CALL &CalcADF1LowR CALL &CalcADF1Freq } } Var 8710 name ADF1High // FSUIPC ADF value high: 3 digits Var 8711 name ADF1Low // FSUIPC ADF value: 1 digit var 8712 name ADF1Freq // total (needed for display): 4 digits var 8713 name CalcADF1Freq Link Subrutine { L0 = &ADF1High * 10 // high * 10 &ADF1Freq = L0 + &ADF1Low // + decimal CALL &OutADF1 } Var 8720 name OutADF1 Link SUBRUTINE { &D_ADF1 = &ADF1Freq &O_ADF1DP = 1 } Var 8730 name ADF1HighR // higher TWO digits controlled by rotarie Var 8731 name ADF1LowR // lower TWO digits controlled by rotarie var 8732 name CalcADF1LowR Link Subrutine { L0 = MOD &ADF1High 10 L0 = L0 * 10 &ADF1LowR = L0 + &ADF1Low } var 8733 name CalcADF1High Link Subrutine { L0 = DIV &ADF1LowR 10 L1 = &ADF1HighR * 10 &ADF1High = L0 + L1 } Var 8740 name PushButton link IOCARD_SW input 1 type P Var 8744 name RO_ADF1 Link IOCARD_ENCODER Input 5 Aceleration 4 Type 2 { L0 = &RO_ADF1 * -1 // change direction IF &PushButton = 1 { &ADF1HighR = ROTATE 20 99 L0 CALL &CalcADF1High CALL &CalcADF1Freq &X_ADF1High = TOBCD &ADF1High // higher 3 Digits in bcd to fsuipc } ELSE { L0 = L0 * 5 // in steps of 5 &ADF1LowR = ROTATE 0 99 L0 &ADF1Low = MOD &ADF1LowR 10 CALL &CalcADF1High CALL &CalcADF1Freq &X_ADF1Low = &ADF1Low // decimal digit to fsuipc &X_ADF1High = TOBCD &ADF1High // higher 3 Digits in bcd to fsuipc } } Var 8770 name D_ADF1 Link IOCARD_DISPLAY Device 1 Digit 16 Numbers 4 Var 8780 name O_ADF1DP Link IOCARD_OUT Device 1 Output 95
-
Post Thanks / Like - 1 Thanks, 0 Likes, 0 Dislikes
samsail thanked for this post
-
01-28-2011, 12:14 PM #16
- Join Date
- Aug 2010
- Location
- Greece
- Posts
- 5
Re: Nico's Kaan NAV1 & Course example
I can’t find words to thank you for helping me with the Sioc scripts.
My ADF1 is operated now perfect.
My best regards
Yiannis
-
01-28-2011, 12:40 PM #17
Re: Nico's Kaan NAV1 & Course example
Hi Yiannis,
It was my pleasure. I hope more people will see how easy and powerful SIOC is.
Have Fun!
Nico
-
02-03-2011, 02:42 AM #18
- Join Date
- Dec 2008
- Location
- California
- Posts
- 18
Re: Nico's Kaan NAV1 & Course example
Hello fellow cockpit builders,
I am new to the hobby ... I just ordered a bunch of parts and I'll be putting together my own OC cards this week... yay! I'm building a LVLD 767 cockpit...
I have good experience in programming and working with hardware, and I have read the SIOC manuals and the bits of code that I have found online... still I am not following the programming language that well... for instance, the & sign is not talked about in the OC manual (or I in the manual I found) plus... how did you pickup this language? the code that was posted in this thread by Nico seemed simple, but I still couldn't follow... would it be possible if you explain a line by line for some of the more SIOC specific lines... I get the IF/ELSE partsand I'm shaky on the VAR parts, but totally confused on the CALL
...
By the way, great site Nico!Mehdi
-
02-03-2011, 06:36 AM #19
Re: Nico's Kaan NAV1 & Course example
Hi,
Welcome on board!
The & sign is just a syntactical symbol (not an operator). It indicates the compiler that the identifier following is the name of a variable. It was introduced to make parsing of the text by the compiler simple. Of course there are more user friendly ways to work with variable names, but SIOC is a very simple language. Do not compare it with C++ or Java, or languages like that.
With the CALL command you call a subroutine variable.
Since you have good experience in programming, it should not be very difficult for you to learn SIOC. Just keep on studying the howto examples at my website and practice by writing small scripts.
And do note that SIOC is an 'event driven scripting language', not a procedural language with a begin and an end, see this example of flow of control.
Regards,
NicoLast edited by kiek; 02-03-2011 at 06:39 AM.
Similar Threads
-
One OC NAV to "copy" it's information NAV1 > NAV2
By jespergb in forum General Builder Questions All Aircraft TypesReplies: 1Last Post: 03-10-2011, 09:46 AM -
Gps/nav1 toggle switch
By renegade in forum General Microsoft Flight Simulator 10 (FSX)Replies: 3Last Post: 07-05-2010, 11:51 AM -
com1 and nav1 from opencockpit, what does it look like?
By jespergb in forum OpenCockpits General DiscussionReplies: 0Last Post: 06-01-2010, 04:49 PM -
MyCockpit.org Welcome's to Nico Kaan
By vybhav in forum MyCockpit News and AnnouncementsReplies: 3Last Post: 04-18-2010, 07:56 PM -
Encoders and NAV1 frequency
By RobertoR in forum FS2Phidget UsersReplies: 2Last Post: 03-03-2005, 07:59 AM