Re: Parallel port
Other option is to use an optocoupler.
The diode can be connected in series with 4.7µF(250Vac) capacitor and a reverse pollarity diode anti-parallel.
The output transistor will be connected between GND (E) and any of datalines of the prallel PC port (with 4k7-10k pull-up resistor) (C).
Having this square wave you can write an application (in any language, starting from old assemble or basic, VB, C, .... ++) which counts time of inputs H or L and converts it to the mains frequency..