There is a plenty of literature on encoders, but in a nutshell, here is what it is about.
First of all, all the encoders fall into two distinct groups: absolute and incremental.
Absolute encoders produce the position signal in parallel format. It means that a 4-bit encoder has 4 signal lines and provides a resolution of 16 pulses per rev (2 to the power of 4); a 10-bit encoder has 10 signal lines and is resolution is 2^10 = 1024 ppr and so on. For every position point within a complete revolution there is a distict pattern of signals that lets you now what position the encoder shaft is at.
All this means the following: a) an absolute encoder lets you know the exact (well, as much as the resolution allows) position of its shaft at any time, even if the power was lost; b) one does not need to use a high-speed counter or a similar module to read the encoder position, a set of ordinary discrete inputs is all that needed; c) absolute encoders are more expensive (10 sets of sensors for a 10-bit one, more pins in the connector etc.; d) absolute encoders by nature cannot tell you the position beyond a single revolution - there is even more expensive version called "multi-turn absolute encoder" which uses a built-in battery power source to keep track of multiple turns.
In addition, most absolute encoders produce the position signal not in straight binary code (0000 = 0, 0001 = 1, 0010 = 2 etc.) but in special format, called "Grey code" (or is it "Gray"? the point being this is not a color but the name of the guy who invented it). This special code minimizes the potential error due to the fact that any two consecutive numbers in it differ in one bit only. This way, an accidental noise on one of the signal lines will not cause a great error. So, when reading values from such an encoder, they have to be converted from Grey code to the regular binary: this is not hard but adds complexity.
From your description you seem to be dealing with an incremental encoder and those are much more widely used than absolute ones. An incremental encoder always has at least two signals, usually designated A and B. The essential trick is
to have one signal follow another signal with 90 degrees phase shift (remember that one complete pulse is considered 360 degrees). Like this:
This is what is called a "quadrature set of signals" so encoders like that are often referred to as "quadrature encoders", "quad encoders" or "A quad B encoders".
If the encoder is rotating clockwise (move the diagram above mentally right-to-left), when signal A transitions from 0 to 1, signal B is 0 and when A transitions from 1 to 0, B is 1.
If the encoder is rotating counter-clockwise (now move the diagram left-to-right), when A transitions from 0 to 1, B is 1 and when A transitions from 1 to 0, B is 0.
So here is the important thing:
an incremental encoder not only produces pulses, it immediately allows to know which direction is it going. A simple electronic circuit can detect the direction of rotation and, based on that, either increment or decrement a pulse count register - that is what high-speed counter cards do. So a PLC can always request the current pulse count value from the HSC module - the value would be correct since the module always knows (by analyzing the encoder signals as described above) whish direction the shaft was moving.
So, incremental encoders are much cheaper than absolute ones (only two signals instead of many); they are not limited to a single turn (pulses are accumulated by HSC as long as the encoder is spinning), but, as it has already been mentioned, there is a problem of losing the correct position after the power was down. Hence the procedure called "origin search", "referencing" or simply "homing" becomes necessary.
Homing in essence is just finding some known and repeatable position of the axis and resetting the position counter in HSC to zero (or any other known value). "This
is my zero point, now start counting from here". In the simplest form, homing is done by moving the axis to a sensor known as "home switch" and resetting the counter after that. This is pretty crude and not very accurate. More refined methods involve moving in one direction until the switch signal transitions from 0 to 1, then reversing and catching the moment when the switch signal transitions from 1 to 0. Much better but still not always acceptable (most switches, after all, may trip at slightly different times; if someone moves the switch, your home position is off). Thankfully, most incremental encoders do help you to find the zero point, i.e. home position, precisely.
If you look at the diagram above, there is a third signal, called "C" (some encoder manufacturers call it "Z" or "index" signal). It does not produce pulses to count, all it does is one pulse per encoder revolution. Its sole purpose is to assist the precise homing.
Now, one more refinement to the homing procedure: after the home switch was detected, keep moving slowly, until the first C pulse comes up. That is your zero point. Note that the position of the home switch becomes not that important anymore: it only gives you a rough estimate of where to look for the C-pulse and homing becomes consistent and repeatable even if the switch is not that accurate or if someone had it slightly moved (well, within one axis revolution). Homing becomes as accurate as allowed by the encoder resolution. Some system (industrial robots, for example) don't even use home switches - they move to a hard stop, detect the increase in motor torque/current, change direction and seek a C-pulse. There are many ways to skin a cat - you will still get a cat skin rather than mink, though.