3 ms·
I had to detect which version of an external circuit board I was talking to. Version 1 had an 8-bit read/write register at location X; version 2 had a 16-bit r
by AnimalMuppet 11y ago
I had to detect which version of an external circuit board I was talking to. Version 1 had an 8-bit read/write register at location X; version 2 had a 16-bit register there. So I wrote out a 16-bit pattern, read it back, and...
... and the card with the 8-bit register remembered all 16 bits!
Turns out that the unused 8 bits were still being driven onto the data bus, and setting a voltage there. Then, when I did the read (microseconds or nanoseconds later), the data bus still had the same voltage, and that voltage got sent to the CPU.
So I wrote a 16-bit pattern to that register, wrote a different 16-bit pattern to a different register, and then read back the first register. Then I could reliably tell whether the board was version 1 or version 2.
Just a very simple thing, but it amuses me still, nearly 20 years later. (Though maybe the problem amuses me more than the solution...)