Ankündigung

Einklappen
Keine Ankündigung bisher.

Python syntax

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Taxus
    antwortet
    Hi Raymond,

    EC[m] tells you, that the logic module has been triggered by a telegramm arriving at pin number m, and
    EN[m] tells you the value of the telegramm.

    Greetinx!

    Einen Kommentar schreiben:


  • Warichet
    antwortet
    Zitat von MarcNaroska Beitrag anzeigen
    The solution which worked for me is:
    "((EN[9] & 1)==1)" to test if bit 1 is set
    "((EN[9] & 2)==2)" to test if bit 2 is set
    "((EN[9] & 4)==4)" to test if bit 4 is set
    Hé, hé
    Thank for the tip . Will try it asap

    Zitat von MarcNaroska Beitrag anzeigen
    That worked for me without any problems after I first tried it in the same way as you did...
    The same cause often yields the same result

    Another question, about the variables EN and EC
    Code:
    EN Array The current value of the inputs.
    EC Array of Boolean
      1 == A telegramm has been received at the input.
    I don't see the subtle difference.
    A word of explanation is welcome.

    Thank you very much.

    Einen Kommentar schreiben:


  • MarcNaroska
    antwortet
    Hey Raymond!

    I had this problem before while developing my Rolladen-Baustein.
    The solution which worked for me is:
    "((EN[9] & 1)==1)" to test if bit 1 is set
    "((EN[9] & 2)==2)" to test if bit 2 is set
    "((EN[9] & 4)==4)" to test if bit 4 is set
    and so on.

    That worked for me without any problems after I first tried it in the same way as you did...

    Einen Kommentar schreiben:


  • Warichet
    hat ein Thema erstellt HS/FS Python syntax.

    Python syntax

    Hi,

    I'l having a problem with the logical "AND" in the conditional part of the Python expression.

    Code:
    5012|0|"(EN[9] & 1)"|"EN[1]"|""|1|0|0|0
    5012|0|"(EN[9] & 2)"|"EN[2]"|""|2|0|0|0
    I'm trying to do a bit wise test on a 8 bit status byte (0-255).
    If the input value EN[9] = 3 and I do a logical "AND" with 1, the result should be non-zero (i.e. 1 in this case) and the formula should be executed. Right ?

    If the input value EN[9] = 3 and I do a logical "AND" with 4 (or 8 or 16 or 32 or 64 or 128), the result should be zero (i.e. 0 in this case) and the formula should not be executed. Right ?

    If I "force" the condition to 1, the formula works as expected, so I'm pretty sure I've a mistake with the "AND" in the condition, maybe a syntax problem ?

    I wonder if it is allowed to have an "AND" in the condition, at all ?
    According to the doc, yes, as long as the result is of type boolean 0-non zero.
    NB: the "AND" in the formula part of the expression works fine.

    Any hint ?
Lädt...
X