Path: utzoo!attcan!uunet!inco!c3pe!charles From: charles@c3pe.UUCP (Charles Green) Newsgroups: comp.sys.atari.8bit Subject: Re: Serial Interface Message-ID: <4426@c3pe.UUCP> Date: 20 Nov 88 20:23:01 GMT References: <9657.192.forumexp@mts.rpi.edu> <22722@cornell.UUCP> Reply-To: charles@c3pe.UUCP (Charles Green) Organization: C3 Inc., Herndon, VA Lines: 50 In article <22722@cornell.UUCP> rbrown@svax.cs.cornell.edu writes: >This can be done with a single chip. There is a nifty little chip called the >MAX232CPE which allows you to convert RS232 voltage levels to TTL levels with >no extra power supply (i. e. with just the five volts available on the >joyport). This can be hooked up to two of the PIA pins in the joyport, as >well as the voltage lines. Only problem with this approach is that it may >require a prohibitive amount of onboard software - I don't know how much the >device handler which would have to be written would entail, or how much of the >work which has to be done can be abstracted to the handler. It may be that >you would also need to add shift-registers and an external clock, but these >are all still non-proprietary chips. If you wanted an all-software approach, you could use a "bit-banger", which is how I understand the ATR6000(?) box worked. To keep hardware prices down, they used its CPU to monitor the SIO line and determine what bits to load into bytes. They had a bit of work getting it to run at the 19200bps SIO port speed, but 300bps, and maybe 1200bps, should be doable by stealing some Pokey channels to use as a real-time clock. The interrupt code for the timer samples the TTL line for the receive data line (and sends a bit out on the transmit data line when appropriate), and every N (which must be more than 2X the incoming bit rate with this approach; I believe 3X can do it, but 4X is more reasonable) samples, makes a decision on what the incoming bit is. (Since there is no data clock which, I understand, intelligent devices on the SIO port use, your "software UART" needs to oversample in the same way that a real UART does in hardware, to find the start bit and properly track data transitions.) But when I got my Atari Technical Reference Manual and learned that the two interrupt lines are unused, I got an idea for an even lower-overhead idea: Present the TTL Receive Data line to one interrupt pin and, using an inverter, its mirror image to the other interrupt pin. On each interrupt, you check the video processor's scan counter and the low-order part of the 3-byte system clock to determine how much time has elapsed; all the intervening N bit times have the same value (1 or 0). But with this scheme you still need a "watchdog" timer, probably a Pokey channel interrupt, which is set when each start bit is received, and tells you when the end of the byte is, since you can't rely on a transition just before the stop bit. But perhaps the simplest solution would be to use the same technique the program recorder uses: turn on the motor control line, send data out without clock or attention signals (so the intelligent devices don't get excited), and use Pokey's own UART circuitry to decode the incoming async characters at whatever baud rate you specify. Of course, if you want the capability of writing the incoming data to disk, you need to XOFF the communications line, temporarily shut down your driver (turning off the motor control line, which keeps the SIO line transitions from going through the device and into the modem - an AND gate may do the job here), and write to disk. When done, raise the motor control line and send an XON. -- Charles Green, C3 Inc charles%c3pe@decuac.dec.com ex::!echo Gotcha: (vi modeline test - is your system secure?)