Jump to content

Sime

Members
  • Posts

    2
  • Joined

  • Last visited

Sime's Achievements

Newbie

Newbie (1/4)

0

Reputation

  1. Admin, please delete my previous post, so no one gets confused. I summarized everything here. I spent in sum probably 4-5h on this P/N edge topic testing it on PLC breaking my head over it. How it works: Lets say we have P-edge contact in certain string of the code. - Every P-contact acts as separate block with its own buffer and additional bit for P edge. - Every time that program scan comes to the -lPl- input its buffer bit state is compared to the current state of the observed MB. - If buffer state is 0 and new MB state is 1, then -lPl-input state is SET (conducts) immediately on that scan and buffer is updated with new MB state. MB state is written only in buffer of this observed -lPl- input not in all -lPl- inputs for this MB if there is more of them in the code! - On the next scan cycle, if MB state hasn´t changed (stayed 1), -lPl- input will compare it´s buffer state (which is now 1) to MB state which is still 1 so no change detected. That means the state of -lPl- input will be non conductive -> -lPl- input not triggered. Since every -lPl- input acts as separate block with its own buffer this will be the behavior of the next program (Lets observe single scan of the program): Program scan start: - String 1: MB1 state 0 - String 2: MB1 output coil was SET in the code - MB1 state transitions from 0 to 1 - String 3: -lPl- P edge input of MB1 is scanned, triggered and will conduct because there was a P transition detected - String 4: MB1 output coil was RESET - MB1 state transitions from 1 to 0 - String 5: -lPl- P edge input of MB1 is scanned but not triggered since the buffer state of this certain -lPl- input is 0 and when compared to the observed MB state which is 0 as well there was no change. Each -lPl- input of the same MB acts as a separate unit! So when one -lPl- input gets triggered, the buffer and the state changes only for that -lPl- input. The rest are still waiting to be scanned and compared their buffer value to the actual MB value. With this in mind it´s easier to predict what happens with -lPl- inputs in subroutines, because they work in the same way. Important thing to note when you test the FW with "Watch option" (sunglasses icon) ! If you click on the MB input and force SET it through Visilogic SW the system will act as you SET the MB at the beginning of the scan not in the middle of the code where this MB actually sits. That means -lPl- edge inputs will act in a different sequence. Example of code: -l P l- -lSET2l- If P edge MB1 is detected SET MB2 -l l- Input MB1 -l Pl - -lRESET2l- If P edge MB1 is detected RESET MB2 If you turn on Watch, click on MB1 input and force SET it the program will act as you would SET this MB at the beginning of the scan and the result of MB2 will be RESET. The proper way of doing it while testing: -l P l- -lSET2l- If P edge MB1 is detected SET MB2 -l l- -( SET )- Input MB3 that SETS output coil of MB1 -l P l- -lRESET2l- If P edge MB1 is detected RESET MB2 If you turn on Watch, click on MB3 input and force SET it, the Output coil of MB1 will be properly SET during program scan in string 2. The result of MB2 will be SET! So when you have P/N edge inputs in the code, avoid directly force SETting the corelated inputs through Watch function in Visilogic SW. Rather Use another test bit which will trigger the output coil of the MB which have P/N edge input contacts in the code. Hope this helps to someone. Simon
×
×
  • Create New...