Cockpitbuilders.com

Main => Builders Discussions => Topic started by: dc8flightdeck on March 06, 2013, 06:19:42 AM

Title: SIOC script to read bit offsets.
Post by: dc8flightdeck on March 06, 2013, 06:19:42 AM
Well, It didnt work like I hoped. I think these commands dont work for reading a bit, only to change them.

When I tried to import the txt file I got the following  error.


Open file "C:\IOCards\SIOC\Atest.txt"
9:21:16 AM
Phase 1
  .OK.

Phase 2
ERROR! - Unknow value
Line: 5    IF &radio = SETBIT 1
==> SETBIT
------------------------------------------------------------------------------------

Posted by: makoy
« on: Today at 06:53:50 AM »Insert Quote




Quote from: dc8flightdeck on Today at 12:17:13 AM

Im glad I noticed this thread, thats the first Ive the SETBIT/CLEARBIT. How about using this offset with the outputs card? I want to use the "good NAV1" offset to control the status light on the 737-200 AP indicator. Would this cause the offset to turn on and off the "good NAV1" on output 97? My switches are not connected through an opencockpits card so I dont need that action in SIOC.

Var 0001, name radio, Link FSUIPC_INOUT, Offset $3300, Length 2 // Additional radio and autopilot status indicatorsLIGHTS

Var 0002, name NAV1, Link IOCARD_OUT, Device 0, Output 97, //  good NAV1
{
   IF &radio = SETBIT 1
   {
       &NAV1 = 1
   }
   ELSE
   {
      IF &radio = CLEARBIT 1
      {
          &NAV1 = 0      }
   }
}


Justin





Hi Justin, i havent play with pedestall and radios yet, but it should work like that.
Title: Re: setbit and clearbit
Post by: dc8flightdeck on March 06, 2013, 07:38:43 AM
I see SETBIT and CLEARBIT are function commands so understand why this only works to change the  bit and not to read it.

Im still trying to understand how to write "IF" script to read the condition of Offset $3300 bit 1 to turn on and off an output on the USB outputs card.

I hope to also be able to set up SIOC script to read the door $3367 bits as well. Im surprised there are no SIOC examples online.
Title: Re: setbit and clearbit
Post by: dc8flightdeck on March 06, 2013, 01:17:07 PM
Success!!!!  :) To read the bits I needed to use CHECKBIT. The following script is confirmed to read the position of door number 1 (the main door) in FSX. In a few weeks I look forward to posting video of the 737-200 door lights in action.


// * FileName : Door.txt
// * Date : 3/6/2013



Var 0001, name Exits, Link FSUIPC_IN, Offset $3367, Length 1     // Exit offsets
{
  &Exit1 = TESTBIT &Exits ,0 // 0 is for exit number one. 1 would indicate exit two.
}

Var 0002, name Exit1, Link IOCARD_OUT, Output 8     //  Exit 1 indicator