[comp.sys.atari.8bit] Serial Interface

george burdell (11/18/88)

   I have an Atari 400 and an old Hayes Smartmodem 300 that I want
   to put on speaking terms. A friend once showed me a little box
   that plugged into a joystick port to turn it into a serial port.
   Can anybody help me find out where to get such a device or else
   a schematic for it? I don't think building one would be a problem
   as long as components can be had.  Also, what kind of software
   driver would be necessary to make something like kermit work
   with a smartmodem and this type of interface?
   (I would rather not spend the $$ for an 850 since I just need a
   modem port, not a printer or anything)

rbrown@svax.cs.cornell.edu (Russell Brown) (11/18/88)

In article <9657.192.forumexp@mts.rpi.edu> george burdell writes:
>
>  a little box that plugged into a joystick port to turn it into a serial port.
>  I don't think building one would be a problem ... components can be had.

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.

Russell G. Brown

gil@limbic.UUCP (Gil Kloepfer Jr.) (11/20/88)

In article <22722@cornell.UUCP> rbrown@svax.cs.cornell.edu (Russell Brown) 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 is, indeed, a GREAT chip.  All you need is the chip, 5V, and 4 common
electrolytic capacitors and you're ready to go.  The chip "generates" the
~ +/- 12 volts for the EIA RS232 using a voltage doubler circuit on the
chip!  The power drain seems pretty low too :-)

|>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

There used to be a modem made by MPP which worked through the joystick
port.  Someone out there in net.land may have this and can slip it under
the rug to both of the askers.  Also around is something that I think
was called Rhandler which was a R: device driver that would drive the
joystick port modem (or 850 I think too!) using R: as a device name (so
you could use any terminal program).  Check Compu$erve or a local Atari
hacker for the latter (I think it may be public domain).

Of course, the best part about the joystick port modem idea is the fact
that you can use the disk drive and RS232 ports simultaneously without
any special suspension/resumption on the disk or RS232 port's part.

Hope this helps!

------
Gil Kloepfer, Jr.          U-Net: {decuac,boulder,talcott,sbcs}!icus!limbic!gil
ICUS Software Systems      Voice: (516) 968-6860 [H]   (516) 746-2350 x219 [W]
P.O. Box 1                 Internet:  gil@icus.islp.ny.us
Islip Terrace, NY  11752   "Life's a ...  well, you know..."

charles@c3pe.UUCP (Charles Green) (11/21/88)

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?)

Albert@PCO-MULTICS.HBI.HONEYWELL.COM (12/16/88)

This is being entered for someone who does not have direct access
to the net.  Reply to me or the list and I will forward, or contact 
Paul directly.
--------------------------
REGARDING THE MESSAGE AT
  Date: 20 Nov 88 20:23:01 GMT
  From: killer!netsys!c3pe!charles@ames.arc.nasa.gov  (Charles Green)
  Subject: Re: Serial Interface

In 1982 I wanted to build a serial port for my ATARI but didn't have much
money, so I investigated building one. Fortunately, I worked for a company
that had an agreement to build hardware for ATARI CORP. so I had a complete
(preliminary) copy of what became the Technical Reference Manual. I
designed and built the hardware, and software drivers, and terminal
emulator (complete with XMODEM file transfers) for a "mainly software"
serial port. It had 2 ports, hardware/software busy and baud rates of 0-9600
baud. (Due to the clock frequency of the ATARI, the margin of error at
19200 baud was a little too big). The hardware consisted of 3 chips and an
external power supply. Today it could be done with 2 chips and no external
supply using the MAX-232.

On of ATARI's best kept secrets was not so much the fact that the POKEY
chip had a serial port built in, but the fact that it was a full standard
ASYNC port! There were two problems: 1. The data was TTL not RS-232. 2.
When diskette (or other intelligent device) I/O was performed, the serial
port needed to be told not to listen.

Problem 1 was easy enough. As was stated earlier the voltage-level
translation is easily done with the MAX-232 chip. At the time however this
chip was not available, so I used the readily available 1488/1489
combination along with a -12v supply. The +12v was available from the SIO
connector, and I added the -12v with a $2.95 DC wall transformer (came from
an old calculator).

Problem 2 was a little more difficult. At first I tried using the cassette
motor control line and had no problem telling the serial port to listen. I
did have a problem telling the port to NOT listen. It seems that the motor
control line decayed too slowly after turning off. It was meant for a
device that drew more current than my tri-state buffer was using.

After a lot of thought, I decided there was no alternative, so I went ahead
and used one joystick port to give me the extra hand-shaking signals that I
needed. This also gave me enough signals to add a second serial port along
with hardware busy for both ports!

Well to make an even longer story a little shorter, I got it completely
working, built a few prototypes, and had dreams of getting rich marketing
it. (At the time the only game in town was the ATARI 850 at about $175).
Needless to say, this didn't happen, and I still use one of my prototypes.
I noticed several references to building an ATARI serial port including
erroneous data, so I thought that if anyone is interested I will dig this
all out of my archives and make it available.

If anyone is interested, I will make available the following:

                        1. Complete Hardware schematics.
                        2. Software driver including source for two serial
                           ports configured as P:, and R: (user changeable).
                        3. Terminal emulator capable of 110-9600 baud,
                           user selects type of busy i.e. Hardware/XON XOFF

Just send me a blank diskette and a SASE with enough postage to accomodate
the bundle. Or, just send $5 and I will send it all to you. Or if you send
me three blank disks and a SASE with postage I will include the source for
the terminal emulator. Or send me $10 and I'll send you everything above
with all the source. It shouldn't cost much more than about $15 in parts to
build the hardware. (THE SOFTWARE AND SCHEMATIC ARE NOT PUBLIC DOMAIN THEY
ARE ALL COPYRIGHT 1983 PAUL M. WALTERS)

My mailing (U.S. mail) address is:
                        Paul M. Walters
                        1140 N. Higley  suite 109-310
                        Mesa, AZ  85205