Serial communication help

Hello. I am new to the programing this year, so I thought I would try to do some before competition time. We are hopefully showing off last year’s robot at homecomming. To make it more interesting, I ordered a chip called the Speakjet which can make the robot speak. All I have to do is send messages to its serial pin with the number of the sound it needs to make. I would like to use one of the digital I/O pins instead of the program port as I only need one data lien and a ground. With a stamp, I would just use the SEROUT command and specify the pin number. However, I have no idea how to make the IFI controler do the same thing.
Ideally, I could send it the words to say via the program port and a terminal app on my laptop, but I kind of think that might be a little difficult. Thanks in advance.

P.S. I though it would be interesting to give the robot the voice of the W.O.P.R. from the war games movie. Then it cam roll up to the head of the chess club and say “Greetings professor. How about a nice game of chess?” Just like in the movie.

There’s a second serial port on the RC, labeled TTL. That second programming port works just like the 1st. If the sound chip needs RS232 levels, you can use the little converter board that came with the cmucams.

Ideally, I could send it the words to say via the program port and a terminal app on my laptop

What prevents you from connecting the laptop directly to the sound chip?

If you don’t have the CMUCAM level shifter, it is almost trivial to build one with a MAX232 or MAX233 chip – add a few caps, a few wires and some solder and you’re in business.

Alternatively, you may be able to track down the level shifter on the sound board you are using and tap into the board where the serial data is TTL voltages again – this will take more courage on your part, but you seem like a bold kind of guy, so I think you could handle it (don’t forget to cut the trace from the output of the level shifter so that the IFI output and the level shifter are not fighting to control the same line).

Good luck,

Joe J.

I was told that there were three ports on the controler and that I could only use the program port. Last year was my first year actually in competition. All my programming knowledge and how the IFI contoller works comes from what I was told. Basically our programmer graduated this year, and all I have to go on is what little he told me. I want to interface the chip with the IFI controller so that it would appear as if the robot was talking. Also, I would not have to be teathered that way. I guess I should have made that more clear. That is why I don’t think I can send commands from the laptop. If I understand correctly, my laptop can not send commands from the OI to the robot. Any programing tips are welcome also. Everything is stored at our partner school, so I can not access it easily. If we show off the robot, I will only have a day or two to troubleshoot programming. I need it to be close to working the first time. All I have to wrok with right now is the lastest version of MPlab, the MC18 compiler and IFI_Loader that I found online yesterday.

Here’s an example program that uses one of the digital outputs to send serial commands to an LCD screen.
Some mods will be necessary to make it compile with the latest MCC18 compiler though. This used v2.4 although the serial part of it is generic and doesn’t care.

Commanding it via a laptop through the program port is fairly easy as well.

You can use the TTL serial port directly without any extra adapters or hardware. The SpeakJet chip does not use RS-232 signal levels and you’ll fry it if you use the programming port. There are code samples on this site that explain how to configure and use the TTL serial port on the RC. I didn’t check the spec sheet for the load, but you should be able to power the SpeakJet chip directly from an unused IO line on the RC. If you have the training board then it would be easier to use the programming port since the training board has the RS-232 hardware and socket installed.

Thanks for the heads up on the serial levels. I read the manual on the chip, but I don’t remember seeing that. I guess I missed it. I don’t know if we have a training board. As I said, we are a partner team. The robot is not built at my school. I can only get access to the cabinet if I go over to De Smet and have someone open it for me. I am basically trying to teach myself to code with no controller and a bunch of old code files. I’m totally new to these compilers and controllers. I have only used Stamps and Lego’s RCX in the past.

How many different phrases do you want to use? One possible solution is to build this as a module using a BASIC Stamp and the SpeakJet chip. You can interface the stamp to the RC using the digital IO lines as a data bus. There are a few different ways to do it, but a simple approach would be to send a “phrase ID” over a parallel data bus:

  1. Define the number of phrases the module will support and number them 0-n. This will be your parallel data bus.
  2. Determine the number of bits needed to represent your n phrases. For example, 16 phrases would require 4 data lines when the phrase number is expressed as a binary number. (32 = 5, 64 = 6, etc.)
  3. Assign an additional IO line as a latch. When the state on that line changes, read the binary value on the data lines and run your code to emit the phrase to the SpeakJet chip.

Your code for the RC will need to set the state on the data bus lines, then toggle the state of the latch line. This is very straight-forward code for the RC. You can test your BASIC stamp module using switches on the data bus lines. The advantage is that you can code, test, and debug your module without the RC. You could implement this with only two digital IO lines using a synchronous serial scheme, but it will be more complex.

Assume you want to play phrase number 3 and you have a 4-bit data bus on digital IO lines D0 - D3 and latch line L. The pseudo code for the RC is:

  1. 3 in binary becomes 0011.
  2. Set D0 = 1
  3. Set D1 = 1
  4. Set D2 = 0
  5. Set D3 = 0
  6. Set L = ~L

Thanks. I hadn’t considered that possibility. I got the chip friday night and have it speaking with the Stamp already. I borrowed a program from parallax and modified it to say what I want. It took me a little while, though, because they had incorrect baud rates. I think I will probably do that. I only need a few phrases. I just want to emulate the W.O.P.R. from the 1982 film “War Games.” We have a chess club. I figured I would have the robot challenge the teacher to a game. Also, I just learned something happed that fried part of the electrionics board, so I will be doing a bit of repair. This will help a lot. Thanks