Thursday, August 14, 2014

On-demand paper jamming...

On-demand paper jamming...  This cracked me up, and brought back memories of some particularly funny bugs I've run into myself.

My favorite one of these was a stepping motor driver I wrote.  I was annoyed by the noise that the head-positioning stepper in floppy drives made.  The noise was caused by the constant step-rate employed by the simple software drivers generally used.  I wrote one that accelerated and decelerated the stepper instead, and was virtually silent.  However, I had a strange “bug” in my driver.  When I first got it running, it would be quiet in the morning when I got to work – but by the afternoon, it was noisy again.  Not as bad as without my driver, but much noisier than in the morning.  How could my software behave differently in the afternoon than in the morning?

Eventually I figured out what was going on.  Our office was ten degrees or so warmer in the afternoons, and the components of the stepper drive expanded a bit.  This increased the rotational inertia in the system, which in turn reduced the acceleration the stepper could apply.  To make it work right, I had to adjust the speed of my driver non-linearly as the ambient temperature (which, fortunately, the floppy drive measured) varied... 

No comments:

Post a Comment