ready961,
Sorry for my original terse response. I was in a very onry mood yesterday.
SAY I JUST WANT TO ROTATE A MOTOR 45 DEGREES THEN STOP THEN 45 MORE THEN STOP AND SO ON, USING A ENCODER HOW WOULD I DO THIS.
If I was in onry mode again I would just say you can't do it with an encoder. An encoder doesn't move anything!
But, there are several ways to move a shaft, the most common way being with a motor. That said, there are several different kinds of motors which you could use depending on the speed with which you want to move the shaft, the load on the shaft and the precision with which you need to make your move.
Discounting that, you can use the encoder in three modes, feedback or open/verification, rotary switch.
In a feedback system (commonly used with servo motors), whatever is controlling the motor is continously looking at the encoder signal and making corrections to the motor output to follow a motion profile.
In open/verificaiton mode (commonly used with stepper motors) whatever is controlling the motor tells it to follow a certain motion profile. Then, after the motion is finished, it checks the encoder signal to see if the motor is where it is supposed to be; if not, it commands a make-up move and checks again. There is usually some range of closeness +/- 3 or 4 counts where the motor is considered to be "in position" so as not to drive the controller crazy.
In rotary switch mode (perhaps used with DC motors), the electronics look at the encoder for a particular position and then turn the motor off so the encoder performs the same duty as a cam on a shaft. Here you would have to know the dynamics of the stopping system so the switching position could be set before the stopping point the right amount.
IN general The above systems are given in decreasing accuracy and cost.
Now, you're still waiting for me to answer your question.
Every encoder has an associated value called ppr (pulses per revolution). This is usually the number of little windows in the disk everyone is talking about. All encoderer systems are really counter systems that count the pulses coming out which are generated by a light beam passing through those windows. Let's say your encoder has 500 ppr. So when you have counted 500 pulses, your encoder has turned 360 deg. So now to know when you have gone 45 degrees, you have to convert to counts 45*(500/360)=62.5. So with this scheme, you can't get EXACTLY 45 degrees because you can't count half a pulse (you really can but let's not get into that now) but you can get close. When your encoder count is at 62 or 63 you are just about 45 deg. You can know 90 deg. exactly because 62.5*2=125 etc.
Maybe you need more resolution, you could run your encoder through a 1:8 gear system so for every 45 deg. of shaft motion, the encoder turns a full revolution; then you get 45 degrees for every 500 counts.
The bottom line is, you always need to know the relationship between counts and degrees or position or however you system is set up. Some nicer controllers let you plug in that conversion and from then on program in your prefered units of degrees, or inches or meters or whatever. How you use that information depends on the issues I mentinoed above.
Hope this helps.