Jump to content

Program for testing encoder

Recommended Posts


I have one encoder that I would like to test if its working ok.
Encoder has 5000 pulses/turn and it has 8 wires:
A, B, Z, A-, B-, Z-, +24V, GND + sheald.

I connected A and B channel on my V430-J-T2 on HSC0 inputs.

My question is can I do the program and test encoder properly to see if A and B channels are working ok?

Link to comment
Share on other sites

  • MVP 2023

Panel V430 has single ended 24VDC encoder input.

Your encoder use two wire for "A", "B", "Z"  signal  == A, A- ; B, B; Z,Z-.

This signal in standard encoder offer +5VDC level. 

Encoder nameplate parameter(model numbers) needed for correct answer what type of encoder output present.

If outputs offer 24VDC level you can  do the program and test encoder properly to see if A and B channels are working ok.

If 5VDC - you must use encoder interface converter like




Link to comment
Share on other sites

  • MVP 2023

Don't even bother with the Z pulse.  A Unitronics HSC input can't handle it, as I recently discovered.  If you read the fine print on the specification guide, setting one of the inputs to "Reset" turns it into a regular input with the speed limitations of scan time. 

In other words, you can't use it to reset the counter.  It goes flying by too fast.

Joe T. 

Link to comment
Share on other sites

Hi to all

Thank you for the answers.

Encoder is 24VDC and I allready connected it on the PLC (picture in attachment).

On HMI I add Variable numeric to see numbers when I turn encoder CW it goes from 0 to 32128 and then switches on -32000 to 0 and again from 0 to 32xxx.

I have one machine that encoder is installed and Im not shore if the fault is in encoder so I would like to test it to be shore before I buy new one.

The encoder measures the length of the sheet metal on the machine and does not show it correctly. On 6000mm of length he shows more then 500mm more, every time different.

Encoder is connected on external panel that has connections A, B, +24V and GND (picture in attachment)


Now I would like to write some simple program that I can see that channel A and channel B working ok.

So its just for bench testing.





Link to comment
Share on other sites

  • MVP 2023

In manual for this controller (P8721)
i see  encoder monitoring function.  In this case your test program calculated the same numbers as original controller.

Now you try to program length on P8721 and this controller display needed length when metal stopped.
But real length is not OK.  Is it true?
Maybe mecanical problem in metal sheet transportation present.  
Please check all motor, pulley, belts, coupling.


Link to comment
Share on other sites

Correct, real lenght is not OK at the end. I look the machine and everything is ok.
Encoder is directly driven from metal sheet by the wheel. Wheel is connected with encoder with a clutch between.

"Between someone changed encoder with new one (RLS RE36IA0613B10F2A00)  and it was working only 1 week and then died. "

How can I make a program on V430 that I can test old encoder and see that A and B channels are working ok without Z ?

Link to comment
Share on other sites

  • MVP 2023
43 minutes ago, kikitron said:

Wheel is connected with encoder with a clutch between

The crucial word here for me is "clutch".  Check that it is engaging properly with no slippage.  Especially as it appears that it was disturbed a week ago.

As for proper testing, you'd need to somehow imitate the mechanical movement needed into the encoder.   I have often had small motors doing a variety of things on a test bench!

cheers, Aus

Link to comment
Share on other sites

  • MVP 2023

You do not need a special program to test.
Please setup the connection to the pre-configured V430 PNP input.
Use only 3 wires. A - HSC0, B - HSC1, GND - V0 ...
The ecoder must be connected to the V350 and to the original system at the same time. +24V encoder wire connected only to original system.
Please place on the screen the ML that is connected to the HSC 4x Shaft encoder input.
After that, please place the Reset button on screen and the program one rung for clear ML to "0".
Testing -> clear the ML, start the machine, wait for the stop in the programmed position, read the calculated impulse in the ML, write it on paper, repeat it, and you will see the same or different number of pulses.


Link to comment
Share on other sites

  • MVP 2023
11 hours ago, kikitron said:

Are the numbers on display 0->32xxx and then -32xxx to 0 normal for encoder ?

@kratmel and @Ausman - you gave him the fix without explaining why, nor tried to get him to discover the answer for himself.  You have not taught him how to fish.  

Anyone who gets into a programming language and gets paid to do it really needs to learn the data types and their properties, whether it be ladder logic in a PLC or a language on a computer such as C.

@kikitron   Here's your homework - look at this page-


Then come back and tell us why the encoder values were doing what you observed and tell us a better way to do it.

Joe T.

Link to comment
Share on other sites

@Joe Tauser  Thank you for the link and I dont know what did you think by homework and C programming.

I dont need to test encoder directly on the machine with original panel and V430. I was just asking if it is possible to test encoder at home on the bench that I can know if its working properly.

One solution is that can be tested with LED diodes on the output signals but is only visual and I think not 100% test, so i thought to use my V430 for better test.

I allready connected the encoder on my V430 like you saw on the video and configure HSC input (A,B) Shaft encoder (X2) / MI 0 and link MI 0 on HMI Variable: Numeric .

Link to comment
Share on other sites

  • MVP 2023
15 hours ago, kikitron said:

I dont know what did you think by homework and C programming

It just so happened I found a page that explained data types and their capacities for the C language.

Unitronics uses the same type of data structures as C (and other languages) for MIs, MLs, MBs, and DWs. 

Here's a big hint - MIs are two byte signed integers.  I'm trying to get you to figure out why your encoder is rolling over to negative values when it passes 32,767.  Knowing this will raise your Programmer Power Level. 

It's got nothing to do with the encoder.

Joe T.

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...