Jan 4, 2011

PLC Program for Omron Encoder Interfacing with Omron PLC

In the Previous Post we saw that how can we connect encoder with PLC for the feedback and calculation of speed and position. In this section we will clearly discuss the PLC Programming of Encoder and associated settings in CX Programmer. If you are unfamiliar with encoder connection with PLC then you can review here. Also you can see the basics of Encoder and some information on types of encoder here.

Settings In CX-Programmer to configure High speed Input:-


First of all we have to configure the high speed counter inputs to which we are connecting encoder outputs. we will see here step by step detail as how to configure it. We are taking example of Omron PLC Cp1E here, however similar settings are there for omron PLC CP1H.

Just open CX-Programmer, then click on settings and go to rightmost tab i.e Built in Input. Under this tab you select Linear and Reset of encoder accordingly. You can see the below picture for a better understanding.


Note:- Click on the picture for a better enlarged View.


Reset of Pulses of Encoder can be done through Z phase or Either Software Reset i.e through our PLC Program. In the Input setting we can choose either of differential type or Up-down input, generally these are selected if we want to track both forward and reverse position i.e while calculating the position of job-piece. In these cases if encoder shaft moves in forward direction and we read 300 pulses and encoder shaft rotate in reverse direction then the pulses will decrease accordingly.


Recommended Article: Using High Speed Counter in Omron PLC


If in any application you just want that pulses from encoder should increase despite of its rotation direction then select Pulse + or Increment as input type in the settings section. Now we are done with settings part.

PLC Program for Reading Encoder Pulses :-

Now we will see how to do the PLC Programming for reading the PV values of encoder. Well there is one instruction PRV in omron PLC which is used to read the high speed counter input values, we have to write that instruction accordingly. In the PRV Instruction we have to specify the Port i.e at which Port we are connecting the encoder, #0010 for port 1, #0011 for port 2, #0012 for port 3 and so on , also we have to specify in the control word as #0 i.e we are reading the value. Also we can reset the encoder PV by setting the System bit, all the things are clearly depicted in PLC Program. You can download sample PLC program for Omron Encoder interfacing here.

If you are facing any kind of problem regarding PLC Programming with encoders yo can write in comment section and we will get back to you. You can subscribe to Automation-Talk by Email for more such tutorials.

Advertisements :-

31 comments:

  1. Please i have a problem displaying pulses on my hmi.
    My application:Is to Measure length,cut and count
    a metal sheet.
    My components are
    Omron PLC CPM2A-CDR-A
    Omron NT ST123EV
    Omron encoder E6A2-CS3C .P/R100

    The problem i have is how to display the pulses on the NT screen,to be able to measure to length cut and count
    For instance;
    1,Measure 3Meters,10 pieces
    2,Measure 16 Meters 12 pieces

    Best Regards
    Mickens ADEJO

    ReplyDelete
  2. Dear MAC,

    Are you able to read encoder pulses in PLC?
    If yes then move the encoder pulses in a CIO word and display that same word in HMI.
    If NO, then first try to read pulses in PLC.

    If you need further help , feel free to ask.

    ReplyDelete
  3. "In the Previous Post we saw that how can we connect encoder with PLC for the feedback and calculation of speed and position"...

    How to get sample programming calculation of speed and position using omron PLC ?

    Best Regards

    Tigor

    ReplyDelete
  4. Dear Tigor,

    First of all welome to Automation-Talk.
    The sample program you can download from the link given in the above post.
    If u need a specific program then please tell us.

    Reagrds
    Injy

    ReplyDelete
  5. Dear Automation Talk,

    Cool information, but I cannot download the sample program as the link seems to be broken. I would appreciate it if you could fix the link problem. Thanks!

    Best,
    Vefik

    ReplyDelete
  6. @vefizoo link is working fine. I have checked and verified.

    ReplyDelete
  7. Dear Injy

    Could you please repost sample programming calculation of speed and position using omron PLC, pulse from encoder or proximity?

    Best Regards

    Tigor

    ReplyDelete
  8. Hello! I have an Omron PLC CJ2M-CPU32 with input/output modules, ID211 and OD212. Can i activate option "high-speed counters" from CX-Progammer and connect and encoder to the inputs of the ID211?

    My encoder is supplied by 5V.

    I would appreciate an answer, Thank you!

    ReplyDelete
  9. Yes, it can be connected. See I/O Module Tab page in the PLC Setting dialog box

    ReplyDelete
  10. Dear Costin ,
    Welcome to automation talk.
    Yes you can connect the 5v output from the encoder at id211 high speed input terminals and for programming details you can download the sample program from above.

    Thanks
    Automation Talk

    ReplyDelete
  11. How can I connect delta encoder(line driver-ES3-11LG6841) to the any PLC???

    ReplyDelete
  12. how to connect encoder to plc?

    ReplyDelete
  13. @ckbak : You can connect delta encoder to any PLC having high speed counter. let us know to which PLC you want to connect.


    @Anil : Please see above post. Or let us know the Encoder and PLC name.

    ReplyDelete
  14. please help me to do programme for Encoder with omron plc.

    ReplyDelete
  15. Please see above article there is a sample Program.

    ReplyDelete
  16. THIS POST AND DISCUSSION HELPED ME , THANKS

    ReplyDelete
  17. i have a high counter unit CJ1W-CLT41 connected to CJ2M CPU32
    It is enough to use the PRV instruction and do the configuration as shown in the picture above or i have to configure other parameters to interface the encoder because in the operation manual of the counter unit, we can see a lot of parameters to set and reset in order to interface tne encoder. Help please

    ReplyDelete
  18. Hi,
    Please help me.
    So i use Omron PLC CP1H,
    i want to use rotary encoder as a feedback to drive the stepper motor.
    How can i program the encoder?

    Thanks

    ReplyDelete
  19. I try your program but i don't understand, and nothing work

    Thanks

    ReplyDelete
    Replies
    1. What issue you are getting ? You will have to modify program according to your needs. It is just a sample program.

      Delete
  20. HI, I want to connect my CPM1A (Omron) to a rotary encoder (Omron E6B2-CWZ6C). How do i read the value from the encoder. I've tried to use PRV but it didn't work. Help please
    Thanks!

    ReplyDelete
    Replies
    1. Please try sample program once. PRV is the right instruction for getting Encoder output.

      Delete
  21. Can you explain the CTBL "Register Comparison table" and the INI "Mode Control" and how to write a plc program with them. I'm looking for example online but I'm having a hard time to find some.

    Thanks

    ReplyDelete
  22. We will try to make tutorials on that. Thanks.

    ReplyDelete
  23. Hi, I'm using Cx-server Lite to read & write data from an Excel spreadsheet and I was wondering if there is anyway to trigger a write "Command" when the number "1" appears into a specific cell "A1" for example?
    I'm using the timer function presently but I find it slows down Excel when it read & writes several data at the same time, so I would like to trigger the "write command" only when its really needed without using the timer function or the manual command button!

    I would use the timer function only to read one DM memory and when a "1" would appear in that memory it would trigger the write command from the Excel spreadsheet.

    Thanks

    ReplyDelete
  24. hi,
    I want to know about device net and can open difference and how they are differ in wiring

    ReplyDelete
  25. Hi, I need the instruction to read encoder pulse in Mitsubishi fx5u plc,can any one pls help me on this...

    ReplyDelete
  26. hi, i have cp1le plc i wanna use flow sensor on pulse input how to calculate in ltr/hr.please help me

    ReplyDelete
  27. hi,
    Im using Cpm2a-30cdr-d.how i can use high speed counter in this????Pls help me.

    ReplyDelete

Receive all updates via Facebook. Just Click the Like Button Below