Ersatz für SetValueBoolean()?

Hallo,

kann man vielleicht in IPS statt SetValueBoolean() irgendeine andere Funktion benutzen, um ein komplettes WORD zu senden? Statt

switch ($key) {   // Key steht hier für port_out
 				case "0":
				SetValueBoolean(15495 /*[W&T\output\output0]*/, true);
				break;
				case "1":
				SetValueBoolean(52789 /*[W&T\output\output1]*/, true);
				break;...

ein Kommando für 12 Output- und 12-Input-Ports zu senden?
Switch mit SetValueBoolean() funktionieren, aber nicht schnell genug…

Hallo,
wenn ich dich richtig verstanden habe möchtest Du aus einer Zahl die einzelnen Bits extrahieren ( Zahl/Dezimal = 5 ergibt Bit0 und Bit2 = TRUE)

<?
$ParentID = 52149  /*[TESTS_FUER_USER]*/;
$EingangsWORD = 5;

for ($i=0; $i <=15; $i++)
{
 $SelektiertesBit = ($EingangsWORD & pow(2, $i)) >> $i;
 $VariablenName = "EINGANG" . str_pad($i,2,"0",STR_PAD_LEFT);
 SetValueBoolean(CreateVariableByName($ParentID, $VariablenName, 0, "~Switch"),ConvertToBoolean($SelektiertesBit));
}



//FUNCTION zum erzeugen einer Variablen über Namen * * * * * * * * * * * * * * *

    function CreateVariableByName($id, $name, $type, $profile = "")
    {
        global $IPS_SELF;
        $vid = @IPS_GetVariableIDByName($name, $id);
        if($vid === false)
        {
            $vid = IPS_CreateVariable($type);
            IPS_SetParent($vid, $id);
            IPS_SetName($vid, $name);
            IPS_SetInfo($vid, "this variable was created by script #$IPS_SELF");
            if($profile !== "") { IPS_SetVariableCustomProfile($vid, $profile); }
        }
        return $vid;
    }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

/****************************************************************************
ConvertToBoolean,
  konvertiert den Übergabewert in Boolaen (Default = FALSE) !!

Example:  ConvertToBoolean(1);
*****************************************************************************/
   function ConvertToBoolean($Value)
    {
	    $Value = strtoupper($Value);

	    if (in_array($Value,array('TRUE', 'YES', 'Y', '1', 'ON', 'EIN', 'J', 'JA', true, 1), true))
	       {
           return true;
          }
	    else
		    {
		     return false;
		    }
   }

?>

tgusi74

Hallo,

etwas mehr Info wäre nett. Ist das setzen der Ausgänge am W&T zu langsam oder das entsprechende setzen der Statusvariablen in IPS? Wie sprichst Du den Wiesemann & Theis an? Ich werde aus Deinem Posting nicht schlau. Ich habe auch so ein Gerät und könnte mit Scripten behilflich sein.

Gruß