encoder rollover

coda9753

Member
Join Date
Aug 2005
Location
Southern Ontario
Posts
10
Any thoughts on how to handle rollover on an Encoder module. I have a module that only counts up to 32767 yet i need to accumulate much much more than that, say 1 million. I'm using a ControlLogix and simply cascading the encoder value with a counter is giving me accuracy grief.
 
You could always try and a poor mans encoder a potentiometer that rotates 360 degrees and use the null spot as a closed contact, set up your ladder logic to count the pulses
 
Two questions:

1) does the encoder have a Z output?
2) Does the counter have a HS input for the Z?
3) Does the PLC have an intrerupt?

Actually thats 3 questions? Anyway the idea is to count the number of revolutions in a seperate counter.

Or if the counter has a preset you can index (INC or DEC)another counter or user memory based on the encoder counter value reaching the preset (32766).
 
What input module are you using on your control logix for the encoder? Is this a 16 bit absolute encoder?
A little more info will be helpful in solving the problem, because 16 bit is not the native word size of the CLX, its a 32 bit machine.

I think that the high speed counter and encoder modules return 32 bit words, so you can count to +/1 2.1 billion. Are you using some other module? If you are using a standard discrete input module (slow encoder?) then you might want to consider creating an EVENT task and configuring the module to generate an event interrupt when the input changes state.

The CLX counters can count to 2147483647 and DINT tags can do the same. You can use a COP instruction to move a negative signed 16 bit integer (from rollover)from an array into a DINT and thus convert it into its signed value that is in the 32768-65536 range.
 
Last edited:
Alaric said:
What input module are you using on your control logix for the encoder? Is this a 16 bit absolute encoder?
A little more info will be helpful in solving the problem, because 16 bit is not the native word size of the CLX, its a 32 bit machine.
CODA included a bit more info when he posted on the Rockwell forum - he's using a flex module 1794-ID.

But I'm still no wiser as to what his "accuracy grief" is.
 
Thanks everybody, ok here's some more details
The processor is actually a flexlogix, with an ID2 encoder card. Even though the processor is a 32bit machine this particular card is only 16bits. There is a Rockwell Knowledge base tech note showing how to configure the output to produce 65000 cnts but that's still not enough.

The total travel of my application requires around 1million counts. And it will travel backwards and forwards so what ever i do i need to count up and down.

Anyways what i have tried is a cascading technique to trigger another counter at 10,000 counts and reset the encoder card. The reset is to slow and we loose about 3000 counts

The next thing was to try and capture the count at 32766 but as expected the count is moving to fast and we miss this from time to time.

I did try a pulse multiplier attached to a totalizer function block but it wouldn't count backwards very good. missing counts and stopping. Although going forward it worked awesome.

I did not try an event task, and this may be a real interesting option. I know that the event will trigger on an external registration mark so it better be fast, but i wonder how it will work on a tag like the encoder output.

Gerry is right i did post on the Rockell forum as well and i received and interesting response. Basically it's the same idea as the Pulse Multiplier / Totalizer, and guess what it also gave me grief going backwards.
Here is the link to that forum

http://www.software.rockwell.com/forum/rslogix/messageview.cfm?catid=14&threadid=9830&forumid=3
 
Last edited:
Coda,

Im not familliar with your PLC so I cant provide code, but here's the general idea.

The 16 bit counter counts to between 0 and 32767, but you need to track 1 million counts without losing your count (accuracy). So what you need to do is leave the counter alone, dont try to reset it, and use a seperate section of code to count the rollovers. You would detcect the rollovers, and the direction of the rollovers by recording the current counter value into TWO differnnt memory locations. Then on the next scan you would compair the recoreded count with the curren counter value. If the current count is something like 10 and the recorded count is something like 32755, then you want to index (INC) another user memory by 1. If the counter value changed in the other direction then you decrement that same memory location by 1. This will give you a value that will record the number of rollovers starting from absolute 0. With that you can do a little simple math and come up with an accurate current count.
 
Mike is right. You don't want to reset the counter for the reason you already are experiencing. He is also right that rollover detection is the way to go. I would handle the increment/decrement a bit differently but that's not a big deal. The important concepts are you DO NOT want to reset the counter and you do want to detect rollover and act accordingly.

Keith
 
Wasting time.

Is anyone aware there is another thread with the title 'Encoder Rolleover'?

The solutions on the Rockwell forum are too complicated. I didn't even to bother if they will work. The solution is simple. I JUST HATE REPEATING MYSELF.
I do amuze myself by watching people post lame answers to things that have be worked out a dozen times before. What good is it for Phil to archive the forum so we can search through it if no one uses the search tool.

Mike is right about one thing. Don't reset the counter!
 
Peter Nachtwey said:
Is anyone aware there is another thread with the title 'Encoder Rolleover'?

Peter, I couldnt find the thread. I remember seeing it, but cant come up with any hits for threads with words in the title the title "encoder rollover". Other searches bring in so many results that it took less time to give my answer then to look for that particular thread.

Another comment: The best thing to do really is to get a counter module or PLC that can handle the expected count. Time is money, and you'll spend more trying to make it work rather then getting the proper equipment.
 
I've dealt with this in the past by comparing the encoder count from scan to scan to determine when (and in what direction) the rollover occurs. You should be able to calculat the maximum difference based on task frequency and RPM of the encoder. In your logic you subtract the current value from the value recorded in the last scan. Say your calculations determine that the greatest negative change without rollover should be -2500 counts, and the greatest positive change should be 2500 counts (Pad these numbers for insurance!). While running, if it rolls over from 32700 to 300, for example, your SUB destination will be -32400. That value is less than the calculated minimum value -2500, so increment your revolution counter. If it changed from 300 to 32700, for example, your SUBtract will return 32400. That's greater than 2500, so decrement your revolution counter. Then multiply revs * range and add actual to get, in raw counts, the total position. This will work if your task scan rate is always faster than 1/2 encoder revolution.
 
I just finished a job that used an ID2 counter module. It wouldn't count backwards at all. Our AB tech support guy came in and looked, and he agreed I had it configured properly. We tried a new module and we couldn't reverse the count on it either.
He spent about 2 hrs on the phone with AB tech support, and they couldnt offer any answers.
The encoder we had only had ABZ wires, and no A_, B_, Z_, however
we were told that "it should still work".
Refusing to give up, I tried connecting the A_,B_ and Z_ inputs to +24V and then ground through pull-up resistors. That didn't help.
As a last desperate attempt, I connected those inputs directly to ground. Voila! Worked perfectly.
So, if you had it working perfectly in one direction and not the other, perhaps you have the same situation that we had.
The funny part of the story is that my boss called our AB guy the next day to tell him we got it working, but refused to tell him how.
The encoder has been in use now controlling an overhead gantry
24/7 for about 3 months now without any problems whatsoever.
 

Similar Topics

I have a single turn encoder controlling my motion project. It is controlling the speed of an elastic web. I have a sensor looking at marks on...
Replies
4
Views
1,683
Could someone outline the process involved in handling a rollover count. I use a HSC to keep track of pieces entering a machine, Then I have...
Replies
2
Views
2,362
G
In our application we are trying to measure length of product traveling on a conveyor. We are using a SLC 5/04 with a with a 1747-HSCE module...
Replies
11
Views
7,588
Hi everyone, This is my first time posting, so please forgive any omissions or mistakes. I am attempting to control the velocity of a stepper...
Replies
18
Views
741
Dears, i am trying to change the series of encoder from A to B, but the program do not has this option (Rslogix5000, 20.06 the old encoder was...
Replies
2
Views
137
Back
Top Bottom