I'm learning about sequential circuits, and it's driving me crazy. How can you use an output as input, what was it's value at time 0? It can't go on forever...
Generally, its input at time 0 is arbitrary unless a reset circuit of some kind forces it. You either have to have such a reset circuit, or your design has to work regardless of the input at time 0.
When designing a circuit it is your job to bring all elements into a valid state after startup.
In most cases you will just keep the
Reset signal active for a certain time ( say 5-10 clock cycles) on all devices. Typically the
Reset signal takes precedence over other signals and you will end up with all your circuits / devices in a valid state.
One point not yet mentioned is that in many cases one might not care about the "absolute" state of an output, provided that changes to the output state take place sensibly. For example, consider a circuit with a one-hot decade counter (e.g. a 74HC4017) driven by an 10.00Hz oscillator, and wired to ten LEDs. Such a circuit will cause all ten LEDs to light up in a sequence that will repeat once per second. The light which is lit at some particular time (e.g. precisely one hour after the unit is powered on) will depend upon which light was lit when the unit is powered on. If one doesn't make any effort to control which light is lit at power-on, it's possible that any one of the lights might be lit an hour later. On the other hand, it's also entirely possible (even likely) that one won't care which light is lit at any given time provided that 100ms later the next light will be lit, then the next, etc.
When latches, counters, and other such devices are used in such a way that their output is indeterminate, there is often a risk that they may in fact enter what's called a "metastable" state, where they can't quite "decide" what their value is. When a device is in a metastable state, its behavior may be essentially arbitrary until it falls out of the metastable state. To use an analogy, think of flipping a coin; it may quickly come up heads, or it may quickly come up tails, or it may spin about on its edge in such a way that it can't very well be resolved as either heads or tails. If the floor is vibrating somewhat, it might not be possible for the coin to sit stably on its edge, but it would be theoretically possible that every time the coin starts to fall the floor vibrates in just the right manner to prevent it from doing so. Were it not for the limits of quantum physics, it would be impossible to absolutely guarantee that a device would fall out of any possible metastable state within any particular amount of time, but the probability of a device staying in a metastable state for a particular length of time can often be made vanishingly small.