The 6522's SR can also be used in mode 100 (shift out free-running at T2 rate) to output a 9-level PWM (0 to 8 bits high), which when followed by an RC filter, is suitable for a 9-level D/A. I've used it to generate DTMF. This is slightly better than 3-bit resolution. Some talking toys only use 2-bit resolution!
Since it's free-running in this mode, it will keep putting out the same value over and over until you give it another value. Feeding
Code: Select all
00000000 for 0, gives .000V output;
00010000 for 1, gives .625V output;
00100010 for 2, gives 1.250V output;
01010010 for 3, gives 1.875V output;
10101010 for 4, gives 2.500V output;
10101101 for 5, gives 3.125V output;
11011101 for 6, gives 3.750V output;
11101111 for 7, gives 4.375V output; and
11111111 for 8, gives 5.000V output.
Simplest 6522 serial port D/A converter output filter, with -3dB point at 4kHz. For driver code, go to http://wilsonminesco.com/6502primer/potpourri.html#DAC and scroll down a little bit.


