PLC Sample Code

Caps, LSS, CPT, Syswin, etc...

92 files

  1. Quadrature Input for Standard CPM1A DC Inputs

    Allows quadrature input from encoders and drives into standard DC inputs on CPM1A or other Omron PLCs. Max Frequency is about 100hz. Format is CXP 2.0 (.cxp).

    2267 downloads

    Updated

  2. Pinstamp

    TASK:
    Do more with less.
    Write PLC code for an ancient Telesis pinstamp printer
    from the early 1990's, replacing a flaky ink jet printer
    that never worked properly
    Existing control system is an AB SLC500 PLC controlling
    a sixteen station assembly line.
    An AB basic module was used to communicate to the ink jet.
    Our options were:
    1) Modify basic module code to suit ancient pinstamp
    2) Find another way of doing it since we were in a hurry
    and didn't have enough experience with the AB system
    to do it in time.
    We opted to take an existing OMRON CQM1 PLC that we had
    gathering dust in the corner, and write code for the pinstamp
    Our part model and reject codes would be sent from the AB
    discretely as binary inputs to the CQM1
    Using the CQM1 RS-232 port, the Telesis functions strictly
    as a printer with no confirmation signals sent back to the CQM1
    Having installed a clock module in the CQM1 we were able to extract
    the Julian day and year and print it along with the model # and
    reject code .
    Not exactly the finest example of modern technology, but it
    works.
    Who said that OMRON and AB can't get along!
    P.S. - DM memory saved in project!

    872 downloads

    Submitted

  3. Basic Servo Control Code for NJ and 1S

    This is a very simple ladder program that shows the basic steps to enable, zero and move a 1S servo using the NJ controller.

    560 downloads

    Submitted

  4. V700-V720 RFID Protocol Macro

    Protocol Macro for V700 and V720 RFID controlllers. Has additional lader code. Need CX Protocol to download to PLC.

    1289 downloads

    Updated

  5. FB Calculate Day Of Week

    Will calculate the day of the week given and date of Year Month and Day

    2067 downloads

    Updated

  6. Woodwood Controler Example Protocol Program

    This is a sample program to communicate to a Woodwood controller. This program is to be used in conjunction with the Modbus Protocol Macro Software. (See download section)

    1700 downloads

    Updated

  7. Lowpass filter function block

    Lowpass filter for Omron PLCs.
    Only tested on CJ-series CPU. Use at own risk!
    Many thanks to Peter Nachtwey @ PLCS.net for providing the mathematical formula.
    Unfiltered = raw unfiltered value in INT.
    TC = Time constant tau, given in seconds.
    Filtered = Filtered value in INT.
    FilteredReal = Filtered value in REAL.
    - The FB can be duplicated.
    - The FB can only be used in program parts that are scanned every CPU cycle, as it relies on the "P_Scan_Time_Value" variable.
    According to the working principles of a lowpass filter, it will take the filtered value tau amount of seconds to reach 63% of the unfiltered value.
    The value will reach within 1% of the unfiltered value in approx 5x tau.

    700 downloads

    Submitted

  8. HHMMSS.cxf

    FB to provide a simple long timer with time remaining outputs. Time can be entered in HMS (or just mins for example).
    Time remaining is normalised to HMS though.
    Uses 2 other FBs. Create instances of HHMMSS as required.

    762 downloads

    Submitted

  9. CQMaster.swp

    Provides for transmission and reception of ten Data Memories each between two CQM1 PLCs

    1279 downloads

    Updated

  10. Polls and Writes setpoints to E5CK Process Controller - E5CK.swp

    Allows CPM2A to poll and write setpoints to E5CK Process Controller. Be sure to load the enclosed Data Memory File (E5CK.ddm)

    1425 downloads

    Updated

  11. V600-E5CK

    Demonstrates how to use the TXD and RXD commands with V600 RFID system and E5CK Temperature Controller. In Syswin format (Can be opened with CX-Programmer.)

    1068 downloads

    Updated

  12. CJ2 to V680S (ETN version) using Socket Service function blocks

    This is a short bit of sample code using Socket Service function blocks to read and write data from / to a V680S RFID tag using the Modbus TCP (-ETN) version of the V680S.

    302 downloads

    Submitted

  13. CJ to CompactLogix Implicit Messaging

    This document shows the steps to create an Implicit Message connection between a CompactLogix or ControlLogix processor, and an Omron PLC on Ethernet/IP.

    199 downloads

    Submitted

  14. CP1 Modbus TCP Peer to Peer

    This solution solves Modbus TCP Peer to Peer applications for CP1H / CP1L PLCs with CP1W-MODTCP61 adapter modules

    231 downloads

    Submitted

  15. cp1l-el/em CP1L-EL/EM Option Board Configuration

    FB for Option Boards in CP1L-EL/EM
    -Configuration of the option board left-right
    -Scaling Selection
    -Analog Input and Analog Output Conf.
    -Tested in CP1L-EM30

    236 downloads

    Submitted

  16. NJ/NX Get IP Address

    A Library containing a function Block that can be run on any Omron NJ or NX PLC. The Function Block will retrieve the host PLC's IP address, Subnet Mask, Gateway, and MAC Address. The Port Details are displayed through 2 structures , 1 per-port. In the event you only have 1 Ethernet port then the structure for the 2nd port will contain all 0s. Data Format:
    IP Address - USINT[4]
    Subnet - USINT[4]
    Gateway - USINT[4]
    MAC - BYTE[6]  (hex value)
    Access the retrieved details by the typical parent-child tag structure. ex. Port_1_Detals.IP_Address[0] will get the first octet of Port 1's IP.
    Tested on: NX1P2, NX102, NX502, NX7, and NJ301
    IMPORTANT: This Function Block should not be run immediately after startup. Allow the PLC a few seconds to establish a connection with the Ethernet network.

    76 downloads

    Updated

  17. CP1L-EL/EM Built In Inputs

    FB used for Built In Analog Inputs of CP1L-EL/EM
    With Scaling Set Up Included
    Demo_Built_In_v1.bak
    Demo_Built_In_v1.cxp
    Demo_Built_In_v1.opt

    201 downloads

    Submitted

  18. Sysmac Studio Simple PID Example

    A simple test program and starting values for the PIDAT instruction in Sysmac Studio. Simply run the simulator (Simulation-> Run) and toggle the Test_PID bit. Simulated feedback will allow the loop to operate normally. The setpoint can be adjusted by modifying the PID_SP variable. There is a pre-programmed data trace that traces the SP, MV, and PV.
    To use the data trace navigate to DataTrace0 and start the trace, flip the Test_PID bit true and the trace will log 10k samples. Change the SP and view the behavior when the trace finishes.

    61 downloads

    Updated

  19. DATE Instruction for CP PLCs

    Sample code to set the RTC on a CP PLC. Individual sections can be enabled/disabled.

    95 downloads

    Submitted

  20. MY PIDAT CONTROLLER SIMULATOR IN CX PROGRAMMER

    this is my PIDAT simulator for CX programmer. D100 is the Steady State (50BCD  in the example), D410 is (simulated)  Process value. It needs a Omron PLC ( kind of CP1E) with n.01 AI, n.01 AO ( AO needs to be wired to AI to run the simulator). When starting set D410 (0:100) and start PIDAT to see the regulator at work.   Keep AT OFF to see tracking process. 

    22 downloads

    Updated

  21. my UNIT STEP RESPONSE

    here simpliest 1st order system response to unit step function. Due to Power series limitations, exponential coefficient * time in sec should be < 2.5 to avoid unaccuracy in the results. 

    5 downloads

    Updated

  22. CRC16 CCITT FALSE

    This checksum was made for the communication of Omron PLCs to the Digitax SF servo drives (Sankyo SFLAG) through RS485. The communication manual for the servo is also available.

    24 downloads

    Submitted

  23. my HYSTERESIS CONTROLLER

    here a simple controller useful for operating an AO with Hysteresis. Proposed range is 50 - 200,  SP 125,  Hysteresis +/-10. Additional Note: an Hysteresis circuit in parallel with a PID controller can be used for tuning complex feedback systems. 

    13 downloads

    Submitted

  24. valve_control

    A working example of an FB to control a valve from an HMI panel. Controls closing/opening times, plus a little visualization.

    51 downloads

    Submitted

  25. my BCD to BIN CONVERTER

    here sinple logic similar to BIN function. Note:no need of error flag here bcs in case of input error, converted output is set to #0000 (on the contrary BIN function activates error flag bcs is  keeping last valid value). 

    9 downloads

    Submitted