TTL on an Apple IIe

This isn’t really FRC related, but it is about robots, so I thought I would post it here. Open house is coming up at my school. I thought it would be interesting to make an automated greeter for the door to the tech room. I have a speaking chip that takes TTL serial input. I also have an old 1984 Apple IIe computer. It does not have a serial port, but it does have a 16 pin game port. The port has several pins that can be toggled easily from 0 to +5 volts with the processor being the only limit to the speed. I need to write a serial protocol for it. I know it can be done, but I am not sure where to start. Any suggestions?

I am no expert but I would guess when sonar detects a person (or button in a mat on the floor) send current to the speaker to say “greetings” and if you want use a motor to open the door. If you mean in way of coding I will not be a big help to you.

Maybe I didn’t make myself clear enough. This is a speakJet chip. It generates sounds based on a TTL serial line. I wanted to use my Apple IIe because I really don’t have anything else to use. I happen to have it lying around doing nothing. It has a game port on it. The port has a pin that can be pulsed from 0 to +5 easily. I know there is a way to write a serial protocol based on this port because it can be toggled like a digital I/O pin on the FRC controller. I just am not sure where to start.

Forgot to add. I am not worried about detecting people coming in the room. That problem is easily solved. The game port allows for four button inputs. I can read the button states to tell when people walk in.

Interesting project… I’m not sure of a quick way to program a serial driver for the IIe’s game port. I was always more of a Commodore 64 guy myself (and it did have an RS-232 serial port, so if you’ve got one of those kicking around it might make your job easier… I could even scan the relevant pages from the manual and send them along).

But I do know that a cheap PIC chip can be programmed using the “serout” command of PIC Basic Pro (www.melabs.com) to do precisely what you want. Well, what you want from a technical standpoint, that is. There is a certain aesthetic statement in using the IIe, I suspect.

Doing a Google search for RS232 should help you to find documentation on the standards that drive typical PC serial ports, but you’ll have to program your own timing loops to send them.

Good luck,

Jason

The only other machine I have is an apple IIgs, which I am missing the floopy drive for. You could actually have gotten a serial card for this machine, but mine does not have one. Since it went out of production years ago, I don’t think I can get one. Also, the output would require RS232 levels. I need TTL. I guess I was thinking they were different. I know TTL and RS232 are the same, I guess I just wasn’t thinking of it that way. Thanks.

I really don’t think RS232 and TTL are the same…

and i’d like to know if I am wrong, please!

here are some stuff I found online:
http://www.seattlerobotics.org/encoder/aug97/cable.html
http://botrics.com/support/cereb/manual/chapter3/3-5-serial.html

Basically they say RS-232 is about ±10 volts
while TTL is 0 to 5v.

-Leav

An excellent point on voltage levels, Leav. I hadn’t really looked in to that in much detail before, because the serial applications I’ve used have been between PIC microcontrollers and PC’s, and I have been able to successfully ignore the voltage specs. Not particularly good practice, perhaps, but it has worked pretty reliably for me.

The PIC Basic Pro Manual in the section on the “Serout” (serial out) command suggests:

While single-chip RS-232 level converters are common and inexpensive, thanks to current RS-232 implementation and the excellent I/O specifications of the PICmicro, most applications don’t require level converters. Rather, inverted TTL (N300…N9600) can be used. A current limiting resistor is suggested (RS-232 is suppose to be short-tolerant).

Not guarantees that that would work with on old Apple, though. I just know that for a few simple applications using PICs and Pic Basic Pro, I’ve been able to ignore the differences between TTL and RS-232.

Jason

Start by understanding the timing and bit arrangement of UART serial communications in general, then look at the specifics of your application.

The “idle” state of the data line is a logic 1, which is +5v in the case of TTL. A character begins with a logic 0 start bit, then continues with each of either seven or eight data bits in turn from least significant (the "1"s bit) to most significant (either the "64"s bit or "128"s bit), sometimes inserts an optional parity bit, then ends with either one or two logic 1 stop bits. So each eight-bit character uses either ten or eleven bits of time to send.

The way most serial receivers work, they will function with up to a 9 or 10 percent difference in clock rates between the transmitter and receiver. I assume the BitJet chip will listen at 9600 bps, with 8 data bits and one stop bit. That makes each bit just a little more than 100 microseconds long.

What language will you be using to program the Apple ]? Do you know how to do precise timing with it?

My extended family had Commodore’s and Atari’s, I have an Apple //e.

The Apple ], ]+, and //e have a couple Apple Made Serial Cards, called “The Serial Card” and “The Super Serial Card”. I have a “Super Serial Card” around somewhere, Plus I have an “Echo II Speech Synthesizer” and other Apple and Non Apple peripherals.

TTL is Serial, just like RS-422/485 and RS-232 are, just a different Hardware Interface. There are converters for each of these to the other.

The Apple ], ]+, and //e have both Analog and Digital Inputs, plus a few Digital Outputs on that 16 pin connector.

I would try to locate an Apple Serial Card (maybe near impossible) or use a Small Micro like in the FRC or Vex Controller to output a TTL Serial Data Stream to the speakJet chip, and use the Apple //e to control it with 0-+5 outputs to the FRC or Vex Controller’s Inputs.

If you are limited to the Apple //e, you will most likely need some 6502 Assembler Code to drive the I/O at the Correct rate.

How soon until your Open House???

Here’s something that might be useful. It’s 30 years old, from the January 1978 “Red Book” Apple II manual, but it addresses exactly what you’re looking for.

See pages 114 through 120. Since you want TTL, you don’t need the RS-232 converter circuit shown. There are a few OCR errors in the code listing (most obviously “3” where it should be “B”), but it ought to be helpful. There’s a numeric value on one line that is chosen to produce a 9.9 millisecond delay for 110 bits per second. Changing that constant should change the baud rate.

Have fun!

Thanks. Open house is in two weeks. I have a Stamp here, but it will hopefully be in use that day. My problem with Pics is that I would have to order one. I don’t like ordering on line because I have to borrow a credit card to do it. The same problem occurs with the super serial card. I will check into the links. The good thing is the port I want to use is already at the five volt level. Also, I will be using AppleSoft Basic to program. If there is a way to use asm, I don’t know it. Basic gives me direct access to the hardware unlike modern computers though. Language should not be an issue.

FYI, the speakjet chip uses 9600 baud by default but I can configure it to take just about any baud speed. It is also 8 bit no parity ($0054) in Pic Basic.

There is a chip that comes in the kit to convert from TTL to RS232 if that is an issue. I don’t remember the pinout, but it was used for the CMU cam.

It is called “TTL to RS-232 Converter Board” on the IFI site. http://www.ifirobotics.com/images/electronics/ttl-232.gif

The chip takes TTL signals. RS232 signals will fry it.

It is a converter, IIRC the PINS are RS-232 (+12V - -12V) the SOCKETS are TTL (+5V - 0V). So it takes Both types of Signals, just on different Ports.

See Threads:
Serial data out of the programming port
Not enought Serial ports

Ok. The driver in the book looks like what I need. I have never done assembly programing before. I have always used higher level languages. I noticed in the comments that the baud rate was 110 baud. Does anyone know how to upgrade this to 9600 baud?

How low of a BAUD RATE can the speakJet chip be set to??

The Apple //e, even with Assembler routines like the one in the “January 1978 “Red Book” Apple II manual” might not be fast enough.

First Guess is that the BAUD setting is a Delay in the State Change of the Output. A Higher BAUD Rate, means less Delay.

The lowest possible baud is 2400. I think the computer can handle it though. The CPU speed is 1Mhz, and I think the speed is limited only by the processor. I decided to translate the program to English the best I could, and I am not even seeing where it sends the data, so I am not sure what exactly it can do.

Way Cool!!! I just listened to a sample, SpeakJet Sample Output (WAV). It sounds just like the Echo II Speech synthesizer for the Apple ] computers.

I have been looking for my Hardware Box for my Apple //e. I have the Apple, and a couple of Disk Drives and a Monitor, but the Additional Hardware I have is missing.