View Single Post
  #8   Spotlight this post!  
Unread 27-08-2008, 08:28
seanwitte seanwitte is offline
Registered User
None #0116
Team Role: Engineer
 
Join Date: Nov 2002
Location: Herndon, VA
Posts: 378
seanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant futureseanwitte has a brilliant future
Send a message via AIM to seanwitte
Re: Serial communication help

Quote:
Originally Posted by dpeterson3 View Post
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