Encoder Values / length ?!?

brettshelley

Member
Join Date
Dec 2007
Location
Durban
Posts
45
Hi Guys,

I have a standard incremental encoder (ABZ) connected to the X0 + X1 of a Directlogic DL06 PLC. All is working but any ideas on scaling the raw encoder values?

EG. 0=0mm 12496=110mm etc...

Cant find any instructions!! I have tried to divide but there is no accuracy!

Cheers in advance...
 
HI,

I have a 1000ppr encoder. I have the high speed counter up/down function set on the DL06. The counter CT174 reads the encoder position perfectly in both directions. I have taken the CT174 value (V1174) and divided it to give me a position in length. If my encoder reads 0, and i let the machine bed travel the full length, i get a reading of 29968. The physical distance from the 0-point is 370mm. If i take 29968 and divide by 370 that gives me 80.99. I only need a 1mm accuracy but the division over the distance does not seem to be correct. Is there any other way of doing this. Ie. For the encoder position to be scaled to the length??

Best regards
 
I assume you are doing this as integer or BCD calculations. Generally speaking, do all your multiplies before you do divides unless that will cause you to exceed the size of a 32-bit integer. Encoder_Count / 12496 * 110 will not yield very good results. Encoder_Count * 110 / 12496 is a much better way to go. Also, make sure your subsequent divide is a double integer divide.

Even the above equation will limit you to 1mm resolution. If you want better resolution you need "implied formatting". For example, Encoder_Count * 1100 / 12496 will result in a value in tenths of a millimeter (5 = 0.5 mm).

Keith
 
Still no luck!!!

I will post a screenshot of the section I am having trouble with!

Maybe that will help so that you can see the problems!!!

Cheers
 
Are they types for all these (V200-V2008) BCD? Please check. Otherwise I can't tell if the green vertical line at the left means the program hasn't been saved to disk or hasn't been downloaded.

Edit - also, in the dataview, be sure that each of the V200-V2008 items are set to DWORD
 
Last edited:
Yes, they are all BCD. I think that this maybe my problem!

This is driving me nuts! Is there another way of using the encoder value to give a proportional length??

Cheer,

Brett
 
Actually, with your code they SHOULD all be BCD. The dataview seems to show the results of multiplying and dividing by non-BCD numbers. Again, make sure that DWORD is selected for the length.
 
Well, have made all BCD, division works fine but accuracy is not. Been at this for 5 hours!

Is there another way of calculating the length??

Best regards
 
You never did say what kind of resolution you are looking for. Assuming all the instructions are working as you have listed you should get 1mm resolution.

Keith
 
Well, just decided to use the 4X multiply on the high speed input!

Maybe that will work??

The calculations do work but over a larger distance the position goes out around 8mm!

This is crazy, next time I need to do something different!

There must be another way! Maybe if I measure 1mm and get the encoder value then use that to increment a register?? I don't know !!

Tired Brett...
 
So is the position wrong by 8mm relative to what you measure with some other standard (ruler, tape measure, etc) or is the number the plc calculates off by 8mm relative to the number you come up with on a calculator using the numbers from the plc? These are two very different things. Is you move to the far end of travel and come back to the starting point does the count return to zero without you resetting it?

Keith
 

Similar Topics

Hello. An absolute encoder on a rotary axis gives values in range -2147483648 to 2147483648. When value is > 2147483648 , the encoder value is...
Replies
20
Views
2,292
I am using an automation direct PLC D0-05 hooked to an encoder to track the movement of an automated cart. The cart picks units off of an...
Replies
3
Views
5,208
Is there a function available in S7 that I could use to check if an encoder value doesn't change for say 2 seconds? I dont know the type of...
Replies
7
Views
5,184
I have an application using an incremental encoder and then I convert it to degree (0-360) using calculation program. For a while, the calculation...
Replies
7
Views
239
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
996
Back
Top Bottom