“An adaptive decoder for LTC data
This is my third (and probably last) post on the topic of Arduino interrupts and timers. In the first two, we discovered how to generate regular interrupts with precise timing, then how to use that heartbeat to bit-bang a serial data signal known as Linear Time Code (LTC). In this post we’ll use an interrupt and a timer to decode an LTC stream at a range of speeds.
There are lots of line codes, serial protocols and the like, each tailored for a particular use. Some strive for speed of data transfer, with tight tolerances and rigid standards. Some are point-to-point, some shared access, some real-time and so on. Horses for courses.
A prime design goal for LTC was flexible recovery. It’s presented for decoding at low and high speeds, in forward and reverse directions, and not always under good conditions. To that end it uses relatively small data frames and spends 20% of its precious bits on a sync pattern.
Decoding LTC is simpler than encoding it and requires less precision, following the old principle of “Be strict in what you output, generous in what you accept.” The more precise the generated timecode and the better its audio path, the greater chance a reader has of decoding it in the face of potential issues like drift, distortion, jitter and asymmetry, all of which it will encounter.
You should refer to the simplified tcReader sketch as we go along. I won’t repeat all the information about timecode we covered in the LTC generator post, so if you need a refresher, revisit there.”