Frequency modulation encoding, or simply FM, is a method of storing data that saw widespread use in early floppy disk drives and hard disk drives. The data is modified using differential Manchester encoding when written to allow clock recovery to address timing effects known as "jitter" seen on disk media. It was introduced on IBM mainframe drives and was almost universal among early minicomputer and microcomputer floppies. In the case of floppies, FM encoding allowed about 80 kB of data to be stored on a -inch disk.
IBM began introducing the more efficient modified frequency modulation, or MFM, starting in 1970. They referred to this format as "double density", with the original FM retroactively becoming "single density". MFM was more difficult to implement and it was not until the early 1980s that low-cost all-in-one MFM floppy drive controllers like the WD1770 emerged. This led to the rapid demise of FM encoding in favor of MFM by the mid-1980s.
Underlying storage mechanism
Main memory systems in modern computers store binary information using two different electrical signals, typically voltages. In DRAM for instance, the presence of a voltage over a certain threshold represents a binary one, while any voltage below that value represents a zero. The letter "A" in ASCII is represented as 01000001 in binary, which might be stored in a typical late-1970s DRAM like the Mostek MK4116 as a series of 0 and 5 V voltages in the individual capacitors making up the memory.
In contrast, magnetic recording systems like floppy disks record this data as a change in magnetic polarity. This is due to the way the data is read and written, using magnetic induction. During reading, the disk is rotating so its surface moves rapidly past the read/write head, a small electromagnet. When the polarity of the magnetic charge on the disk changes, a brief pulse of electricity is induced in the head which is read as a one, any section where the polarity does not change produces a zero. To encode the same letter A, assuming the previous data ended with a zero, a disk would use 01111110. The first zero-to-one transition causes a 1 to be output, the stream of ones following causes no output, and finally the last one-to-zero creates the final 1.
In addition to the data being stored in patterns that require on-the-fly conversion to and from their internal format, the disk faces additional problems associated with being an analog system – noise, mechanical effects and other issues. In particular, disks suffer from an effect known as jitter due to small changes in timing as the media speeds up and slows down during rotation. One form of unavoidable jitter is due to the hysteresis of the magnetic media, which can lead to an effect known as bit shift that causes the strings of magnetic transition to be stretched out in time. These effects make it difficult to know which bit a particular transition belongs to.
To address this problem, disks use some form of clock recovery using additional signals written to the disk. When the data is read, the clock signal is separated out and data bits can then be clearly seen in the signal and be cleanly lined up into the appropriate slots in memory.
Encoding
FM encoding uses a simple system to encode the original data in such a way that every bit of data will contain at least one transition, ensuring there are enough transitions during a given period for a successful clock recovery. To do this, it operates with a basic data period twice that of the maximum frequency of the recording media. These are known as "clock windows", with up to one clock transition and one data transition per window. Since each bit of data requires two minimum times, FM encoding stores about half the amount that is theoretically possible on that media.
FM uses an implementation of the differential Manchester encoding. A zero in the original data is encoded by a single magnetic flux transition during the period, and ones are encoded as two transitions. For instance, if a byte of data from the original system contains the bits 01000001, the floppy disk controller will translate this into the series 1011101010101011, inserting additional signals in front of every bit to represent the clock. When this signal is then sent to the read/write head, the polarity will be flipped every time there is a pulse. In this example, if the head was originally in the low state at the end of writing the last data, the leading 1 will flip it to the high state, and the following zero will leave it there. The result is a single transition in that window. The next bit will first flip the state back to low, and then flip it back to high, for two transitions in the window.