Tip of the day, #6
Without bit-banging, you can also use the 6522's synchronous serial port in mode 101 for limited, but relatively fast, RS-232 output (adding a line driver). CB1 need not be connected for this. Since T2 only uses its counter's low byte to control the baud rate, the slowest you can go at 2MHz is about 4800 bps. To go slower, use mode 111, even if you use T1 and PB7 on the same 6522 to supply the external CB1 clock. RS-232 goes out low bit first, so you'll have to reverse the bit order in software.
You could conceivably get all 8 data bits + start and stop (who uses parity?) by making a word extend across the boundaries of consecutive SR operations, but you'd probably add a 6551 if you really needed the full RS-232 complement. Otherwise, since the 6522's SR only gives 8-bit frames and you need start and stop bits, you're left with 6 bits for data. With this 40H range, you can still get every character you see on your keyboard (no lower case) by subtracting a 20H offset from the ASCII value. If the receiving computer is set for 7 or 8 data bits, the last bit(s) will always be high because of the early stop bit. Add 40H or C0H, plus your offset, to make the data conform to ASCII again. If your offset excludes needed characters like CR and LF, you can substitute characters you don't need— maybe \ and _ . The short word will usually require leaving a couple of bits' extra time before starting the next byte, to ensure that the receiving computer sees a valid stop bit.
_________________ http://WilsonMinesCo.com/ lots of 6502 resources The "second front page" is http://wilsonminesco.com/links.html . What's an additional VIA among friends, anyhow?
Last edited by GARTHWILSON on Wed Feb 22, 2012 8:08 am, edited 2 times in total.
|