Also erstmal solltest du uns vielleicht erzählen, mit welcher Steuerung bzw. welchem Hersteller du überhaupt programmierst.
Weiterhin bietet deine Aufgabenstellung eine prima Gelegenheit, sich selber mal ein bissel einzulesen, um solche Probleme in Zukunft selbst lösen zu können.
Da ich Google bedienen kann, habe ich mittlerweile herausgefunden, dass du vermutlich mit Wago programmierst.
Weiterhin habe ich auch Erfahrung mit LON.
Google hat mir auf die schnelle mal wieder gezeigt, wie so ein SNVT_Switch eigentlich aufgebaut ist.
Code:
[I]SNVT Name:[/I] [B]SNVT_switch[/B]
[I]SNVT Index:[/I] [B]95[/B]
[LIST]
[*][B]SNVT_switch[/B] is the most commonly used [URL="http://automationwiki.com/index.php?title=Standard_Network_Variable_Types_%28SNVTs%29"]SNVT[/URL] while sending binary data on a LonWorks network.
[*]It is a two byte value consisting of an analog value in the left hand byte (VALUE portion), and a binary state in the right hand byte (STATE portion).
[*]The VALUE portion has a range from 0-100% whereas the STATE portion can assume a value of 1 or 0.
[*]The raw data type for these two values is byte i.e. a value ranging from 0-255, hence care must be taken when transferring values into this SNVT to make sure the source values are within the legal range. If a value is placed into one of these bytes that is deemed out of range, then a -1 value will be sent on the [URL="http://automationwiki.com/index.php?title=LonWorks"]LonWorks[/URL] network to indicate out of range.
[/LIST]
Mit dieser Info kann man sich die von dir benötigte Funktion (PACKSTATE) relativ einfach selbst zurechtlegen.
Du musst eben die beiden Eingangsvariablen BYTE, BOOL entsprechend der Beschreibung des Datentyps in die Ausgangsvariable DWORD verpacken.
Man kann sich dann z.B. auch noch vom bereits vorhandenen FBUNPACKSTATE im Onlinebetrieb das Verhalten abschauen (wo steht die BOOL-Variable in der DWORD-Variable, etc.) - das hilft auch weiter.