Previous PageNext Page

OTHER BLOCKS

R_TRIG - Rising Edge Trigger

The R_TRIG is a function that may be used to trigger another function on the rising edge of a transition. When the CLK detects a false to true transition, the output (Q) is energized (for one scan of the program only).

  1. We will now use the R_TRIG function in a ladder diagram.
  2. Place EZ LADDER® in the Edit mode (if in the Monitor mode).
  3. Close any currently open ladder diagrams (save them if necessary).
  4. Create a NEW ladder diagram Project.
  5. Configure the target as follows: (if you use a different target, some of the features may not be available)
    1. PLC on a Chip, Model PLCHIP-M2-25631
    2. Install Digital Inputs : GPI0 - GPI7
    3. Install Digital Outputs : GPO0 - GPO7
    4. Install Analog Block Analog Block 0
    5. Install the Real Time Clock
    6. Install the SSI Bus
  6. Using the Insert Function drop down menu on the tool bar, select R_TRIG.
  7. Place the cursor on Rung 1 near the center of the ladder diagram workspace and left-click to place the object. The Function properties dialog box will appear, click OK. The R_TRIG is now placed.
  8. Using the Insert Function drop down menu on the tool bar, select CTU
  9. Place the cursor on Rung 1 to the right of the R_TRIG function and left-click to place the object. The Function properties dialog box will appear, click OK. The CTU is now placed.
  10. Select the DIRECT CONTACT button from the tool bar.
  11. Place the cursor on Rung 1 near the left power rail and left-click to place the contact. The Contact properties dialog box will appear. Using the drop down menu in the dialog box, selct GPI0 and click OK. This finishes the placement of the contact that is tied directly to hardware input GPI0 (also named GPI0).
  12. Select the DIRECT CONTACT button from the tool bar.
  13. Place the cursor on Rung 2 near the left power rail and left-click to place the contact. The Contact properties dialog box will appear. Using the drop down menu in the dialog box, selct GPI1 and click OK. This finishes the placement of the contact that is tied directly to hardware input GPI1 (also named GPI1).
  14. Select the DIRECT COIL button from the tool bar.
  15. Place the cursor on Rung 1 near the right power rail and left-click to place the contact. The Coil properties dialog box will appear. Using the drop down menu in the dialog box, selct GPO0 and click OK. This finishes the placement of the coil that is tied directly to hardware input GPO0 (also named GPO0).
  16. Select the HORIZONTAL LINK tool.
  17. Draw a link from the right side of the GPI0 contact to the CLK input on the R_TRIG function.
  18. Draw a link from the right side of the GPI1 contact to the R input on the CTU1 function.
  19. Draw a link from the Q output of R_TRIG to the EN input of the CTU1 function.
  20. Draw a link from the Q output of CTU1 to the left side of the GPO0 coil..
  21. We now need to insert variables to counter circuit. Select the INST VARS button from the tool bar.
  22. Place the cursor on Rung 3 just left of the PV input on CTU1. Left-click to insert the variable. The Variables dialog box will appear. Select the INTEGER tab.
  23. Click the ADD button to add a new variable. The Add variable dialog box will appear. Type Preset for the Name, select INTERNAL as the variable type and set the DEFAULT VALUE to 10, then click OK.
  24. With the INST VARS still selected, place the cursor on Rung 3 just right of the CV output on CTU1. Left-click to insert the variable. The Variables dialog box will appear. Select the INTEGER tab.
  25. Click the ADD button to add a new variable. The Add variable dialog box will appear. Type CntVal for the Name, select INTERNAL as the variable type and leave the DEFAULT VALUE blank, then click OK.
  26. Save the ladder diagram from the File menu and selecting SAVE. It is a good idea to periodically save your ladder diagram when developing it.
  27. Compile the target using the COMPILE button from the tool bar. Ensure that the compile is successful and there are no errors. If there are errors they must be corrected. Your ladder diagram should look similar to this:


  28. We are now ready to run the program on the target. Switch to the Monitor mode by clicking the MON button from the tool bar.
  29. Connect to the target, by selecting the CONNECT button from the tool bar. If a different program is running, just click OK.
  30. Download the ladder diagram to the target by selecting the DOWNLOAD button from the tool bar. If successful, the ladder diagram is now operating on the target. It should look similar to:


  31. The CntVal output from the counter is 0.
  32. Close the switch connected to Input 0. GPI0 is true causing power flow. The CntVal output from the counter will increment (for each low to high transitioin of GPI0).
  33. Open the switch connected to Input 0.

You have completed the R_TRIG exercise.

  Previous PageNext Page