Jump to content

Recommended Posts


I have V350-35-T2 PLC controler. At imput 3&4 (input I2 & I3) is shaft encoder (signal A and signal B from shaft encoder).

Shaft encoder value is defined in program and this value decreas and increase, depends on witch way, shaft encoder turn.

Reset shaft encoder value is in software at 360° (1440 - x4). With this value i can count turns + i have control over angle.

frequency (max.) for this PLC is 20kHz (at 10m of cable, i have 5m of it). My first question is, if frequncy is halfed (10kHz) becuz I use channel A and B)? I can then use only 10kHz?

Problem occures at 100RPM (its the lowest RPM of motor) width subtract angle. When first 360° is over at my PLC i see 359, 358,357..depending on speed of motor. Moore time shaft is turning the lowest is number. The error is integreated over the time period. So at 30 turns i have left only with around 330° (depends what speed I use - arround 120 RPM).


Shaft encoder have 360 PPR and he is at 100RPM...This is 600Hz.


I dont get it, why 600Hz is to fast for my PLC. I configure input 2 & 3 as shaft encoder (x4) + reload. Reload accure at 360° rt at 1440°(cuz number is multiplayed x 4) (at full circle).


This shaft is mounted on mashine. This mashine create one product in 360° and stoped at exactly 360° (0°) -> full circle.

its seems that shaft encoderis is not able so quickly read angle? But i dont geet it - shaft encoder is high speed encoder for max speed 6000 RPM. Maybe there is something wrong with input of PLC? I configure it as shaft encoder etc...


Shoud i wrote PLC program in 2.5 mS interrupt? My program have just 3 lines of code (linearization, counting pulzes, reset at 360°). That's it. Should i use immediate function blocks?

Can i use them in "normal" program, or  they must be in interrupt, otherwise they will not work properly?



thx for the answers 

Best regards
Dejan Rožič

Link to comment
Share on other sites

  • MVP 2014

I think the error is in the timing of the reload, as the PLC scan is much slower than the incoming encoder pulses.


You should get the result you want if you go into the hardware configuration of the high-speed counter, and change the configuration from a normal "High-Speed Input" to a "High-Speed Input (Reload)".  Make sure you remove the original configuration, so you only have one configuration for that input.  Put 1440 as the reload value.  When you use the hardware configuration like this, the reload is executed at the speed of the I/O hardware, not at the speed of the PLC software scan.


As for your incoming pulse speed, I have always understood the limit to be on the physical pulse speed.  So 20kHz is 20kHz, it doesn't matter whether it is a 2-channel quadrature signal or a single-channel pulse.  I am happy to be corrected if this is wrong.

Link to comment
Share on other sites

  • MVP 2014

One other thought, its a while since I played with this, but if your system is likely to turn in reverse, just check how the reload behaves in that case.  I seem to recall it being necessary to swap the sign of the reload value (make it -1440 for negative rotation)

Link to comment
Share on other sites



Nothing work for me sry =(


I just try with interrupt at HSC 2,3. Reload value is set at 1440 (x4).

PLC reset counter when is 1440..all is fine there. Interrupt works fine.



1. Start PLC. Shaft is at 0° (reset value).

2. Shaft encoder slowly turns at 380°.

3. Slowly get to 360°+ ...0...1...2...3...°.. Interrupt works fine.


but if i turn faster shaft encoder  around 360°(0°)... ERROR again appears.

If i by hand turn my encoder a litle bit faster, then, after 10 circles, i got, at 0° -> value 355° or 5°... ITS NOT ZERO...



I've tried it all, do not know what else to do...


So this "error" appears if  turn my shaft encoder fast over the 360° (when interrupt appears)..what is wrong?


bdw; i try reset value in lader with index/z signal...It works great (ofc at very low hand speed - problem with sensing index signal)

Link to comment
Share on other sites

  • MVP 2014

As I understand it, the Reload function of resetting the counter to zero should happen without needing an interrupt.  It is done purely in the I/O module  I have tested his in the past, and that is how I remember it.  The interrupt is only used if you also want to do other functions.  Using the interrupt to reset the counter has the potential to lose counts at higher speeds.  Please test what I say here, I am willing to be corrected if this is not correct, I don't have time to wire up an encoder to test.


There is also the chance that you are losing counts due to a bad waveform on the pulses from the encoder.  This becomes more noticable at high speed.  You can test for this by using a much shorter cable.  Also an Oscilloscope can let you see if the waveform from the encoder is nice and sharp or distorted.  When using an oscilloscope to view the signal, try to turn the encoder at a constant speed.

Link to comment
Share on other sites

Yes I configure HSI + reload (Enable Reload is always "1" - power up value SET - "1"). This function automatic reset value at 1440 (predefine value). In this case I dont define interrupt. This dont work for me neither. PLC again "missing" counts.


Then i configure  HSI + reload, but without power up value in Enable Reload (now can I reset value within _Interrupt). Then configure _Interrupt HSC 2,3. When couter value is at 1440 interrupt appears. In interrupt is one coil. This coil "activate" Reload Event and reset counter value. This dont work - again missing counts.


This are result from oscilloscope. On first picture are A and B signal. On second picture are B and index/z signal. All looks great.



First picture cLICK

Second picture CLICK



-- I dont know why i cant add pictures to the forum - Invalid image extension. I've try *bitmap and *jpg.

Link to comment
Share on other sites

I just finishing with test on my PLC with shaft encoder.

I've tested shaft encoder on input 2,3 (HSC 2,3)... and auto reload at difrend values. Then i turn my shaft 20x - 20 circuits.


my result are here: CLICK

Like u see in linearizacion I make difrend values. when i make 360-1440 value and reset at 1436, then PLC count OK. But after 20 circuits i have 15° (must be 0°). Why is this shift?


If i make defalut value (360...1440) and reset at 1440....then like you se, PLC count wrong (359°, 360°, 0°, 1°...) but after 20 circuits, i have again 15° error.

I make this test for each value twice. So values should be right.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...