Going by your last comment, I assume I've hit the task you were trying to accomplish.
This is pretty easy to do in software.
We'll call you input signal I and your output signal C
Do the following:
- C starts out at value zero.
- Watch the values for I. When I goes from negative to positive ( or crosses some other threshold going up) set C to 1
- Watch the values for I. When I goes from negative to positive ( or crosses some other threshold going up) set C to 0
- Repeat steps 2 and 3.
For every sample of I, you get a C that is either 0 or 1. You can send the C value to a DAC or process it further.
This will generate a square wave at half of the frequency of the signal from I.
In an analog system "sharpening the rising edge" (see my earlier comment) would be accomplished by amplifying the signal. Digitally, you can either set a fixed threshold and multiply the incoming values, or lower the threshhold.
The accuracy of the synchronization depends on the sharpness of the rising edge. The sharper the better. With a perfectly vertical edge, the generated clock will be one sample behind the real signal. The slower the rising edge goes up, the more the generated C will lag. At worst you will be 1/2 of a cyle behind, but that takes a really flat rising edge.