Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. Skripten / Logik
    4. Blockly
    5. Bit set und reset in Blocky

    NEWS

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    • Monatsrückblick - April 2025

    Bit set und reset in Blocky

    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      jomixl last edited by

      Hallo,
      ich mache gerade meine ersten Versuche mit Blocky. Ich bekomme von einer
      SPS die Stati für Ein- und Ausgänge über Modbus. Nun würde ich gerne ein
      Bit in einem Holdingregister ändern und suche dafür eine Funktion in Blocky
      mit der ich das machen kann, d.h. sowas wie and und or für word/byte.
      Gibt es sowas in Blocky?

      Danke jomixl

      paul53 1 Reply Last reply Reply Quote 0
      • paul53
        paul53 @jomixl last edited by paul53

        @jomixl sagte in Bit set und reset in Blocky:

        Gibt es sowas in Blocky?

        Ist mir nicht bekannt. Wenn es Blockly sein muss, dann kann man eigene JS-Funktion mit Ergebnis verwenden. Inhalte:
        checkBit: function(val, bit)

        return val >> bit & 1;
        

        setBit: function(val, bit)

        let x = 1 << bit;
        return val | x;
        

        resetBit: function(val, bit)

        let x = 1 << bit;
        return val & ~x;
        

        EDIT: Funktion checkbit(val, bit) korrigiert.

        1 Reply Last reply Reply Quote 0
        • J
          jomixl last edited by

          hallo,
          danke erstmal, es muss nicht blocky sein, war eben mein erster Versuch in ioBroker was zu steuern. Falls es bessere Möglichkeiten gibt bin ich für jeden Tip dankbar.
          Ich programmiere sonst in Pascal und tu mich mit JS etwas schwer.

          Gruß jomixl

          paul53 1 Reply Last reply Reply Quote 0
          • paul53
            paul53 @jomixl last edited by paul53

            @jomixl sagte:

            Ich programmiere sonst in Pascal und tu mich mit JS etwas schwer.

            Mit den Kenntnissen sollte die Eingewöhnung in JS nicht schwer fallen. Die größte Umgewöhnung wird die asynchrone Abarbeitung (Ereignis gesteuert) sein. Das ist aber in Blockly nicht anders.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post

            Support us

            ioBroker
            Community Adapters
            Donate

            478
            Online

            31.7k
            Users

            79.8k
            Topics

            1.3m
            Posts

            2
            4
            1135
            Loading More Posts
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes
            Reply
            • Reply as topic
            Log in to reply
            Community
            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
            The ioBroker Community 2014-2023
            logo