CODESYS: IF-ELSEIF instruction in Structured text programming

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ต.ค. 2024

ความคิดเห็น • 16

  • @jacobksqd
    @jacobksqd 25 วันที่ผ่านมา

    Excellent tutorials. Thank you. I am doing all of them.
    For this tutorial I have 2 suggestions:
    1. Use CounterPV within the IF/ELSIF statements instead of Counter01.PV (This way the operations of A, B, C change the preset value)
    2. Use smaller PV values in the test of the logic so that you do not need to flip the switch so many times to validate the logic. (IE: 12, 14, 16 instead of 50, 175, 300) After the logic is proven to be correct, adjust the numbers back to the higher values as desired.

  • @LearnSomethingHelpful
    @LearnSomethingHelpful 3 ปีที่แล้ว +1

    Nice video Tohid

  • @endprg6477
    @endprg6477 3 ปีที่แล้ว +2

    Спасибо. Всё наглядно.

  • @darkaster134
    @darkaster134 5 ปีที่แล้ว +1

    Hi, could it be possible to have more than one effect if entering the if?
    For example: IF (A ) THEN (B , C:=FALSE) or something like that

  • @kalyanikadkol4006
    @kalyanikadkol4006 5 ปีที่แล้ว +1

    Hello Tohid,
    Thanks very much for such an informative tutorial!
    However, in this case, the Full continues to become true when CV=10 although the PV of the counter gets updated in Counter01.PV depending on the selection between A, B and C.
    What should be done to update the code such that the CV now considers the new PV whenever the conditions are true and not the PV value initialized in the variable declaration?
    Your inputs are valuable!
    Many thanks,
    Kalyani

    • @TohidAlizadeh
      @TohidAlizadeh  5 ปีที่แล้ว

      Thanks for your comment. I believe that you should not do anything and the counter should consider the new PV. I will have a second look at it and let you know if this is not the case.

    • @kalyanikadkol4006
      @kalyanikadkol4006 5 ปีที่แล้ว

      Thanks very much for having responded to me!
      What I meant is if the PV is updated, the CV should consider and turn the counter's output with respect to the new PV, isn't that how it is supposed to work?
      What happens with the code is that the PV gets updated, but the CV continues to turn the output on for PV = 10.
      Can you please help me understand how the counter operates?
      Thanks again for your time!

    • @IsmailRosli
      @IsmailRosli 5 ปีที่แล้ว

      @@kalyanikadkol4006 Same, encountered the same issue. Do you happen to find out how to fix it?

    • @KhairulBasarAbuAbdullah
      @KhairulBasarAbuAbdullah ปีที่แล้ว +4

      @@TohidAlizadeh Corrected: Counter01(CU:=LS1,Reset:=Reset,PV:=CounterPV);
      IF A THEN
      CounterPV:=5;
      ELSIF B THEN
      CounterPV:=3;
      ELSIF C THEN
      CounterPV:=2;
      END_IF
      Full:=Counter01.Q;

  • @elhassanemargoum7955
    @elhassanemargoum7955 5 ปีที่แล้ว +1

    Hi Tohid
    Thank you for this videos
    I want to know how to program an if statement with multi conditions (if a:=1 & b:=1 then c:=1 else ...)

    • @TohidAlizadeh
      @TohidAlizadeh  5 ปีที่แล้ว +1

      Hi there,
      I think you can use parentheses to do so:
      IF (a = 1 AND b = 1) THEN
      c := 1;
      ELSIF d=1 THEN
      .
      .
      .

  • @victorponce1065
    @victorponce1065 4 ปีที่แล้ว

    Hello, how can the functions be used in CFC?

  • @akperera2663
    @akperera2663 2 ปีที่แล้ว +1

    Hi Are you doing the ST programming training session online