![]() |
Using an FRC with the RCX?
I was lieing in bed this morning when it hit me: Since the prog port is RS-232, and so is a computer, there is a chance you could connect LEGO's old COMM tower with the prog port on the RC or the EDU. You would probably need to make a custom cable, but it might work.
Basically, to control the RCX, you send it IR messages via the IR tower. From there it's a simple matter of programming the two. The LUGNET thread for sending messages in VB can be found here. Here's some FRC code to do it: Code:
#define SendByte(Byte) {TXREG = Byte; Wait4TXEmpty();}The RCX has outputs A, B, and C. They can be Forward, Backward, or stopped, and have a speed of 1-8. This can be expressed as -8 to 8. If you just want 2 motors, you can set both in the same byte in the range of -7 to 8. Use the first 4 bits for A and the second 4 for B. In NQC: Code:
// A Basic RC Skid-Steer Program (Recieve)In the FRC: Code:
void Set2RCXMotors(signed char Left, signed char Right)If you want to control all 3 outs directly, then you'll have to specify which one. The first 2 bits are what out, 3 is 0, 4 is direction, 5-7 are power-1, and 8 is "Is on?". So, in a nutshell: MM0D PPPOn. On the RCX: Code:
// A Basic RC 3 Motor controlCode:
void Set3RCXMotors(signed char Left, signed char Center, signed char Right) |
Re: Using an FRC with the RCX?
That'd probably work. It would be interesting, you could say, have the RCX in charge of controlling drive motors, leaving the RC free to determine where you want to go, etc. I have a Mindstorms set (plus all of the expansions (a few of them twice :))), so I might find this and interesting thing to look into.
--EDIT-- Oh, yeah. NQC is good, but BrickOS (former LegOS) is better. :) BrickOS is also C/C++ programming, but everything is precompiled, not interpruted like with NQC and the default LEGo firmware. |
Re: Using an FRC with the RCX?
Plus, if you have an RCX v1, there is a 9-volt AC adaptor plug in the back (made for the train adaptors). So, connect the 12v Exide to a 12vdc-9vdc transformer, hook that up to the RCX, and you don't need to use 6 AAs!
Anyway, The connecting cable won't be standard: the tower is a Male with just enough space for the cable that came with the kit (No screws). The FRC prog is female. Both the FRC prog and the LEGO IR Tower (LIRT) are made to connect to a computer, so there are going to be problems if you just connect them directly. (Some good info on RS-232 can be found here.) Using the jargon, we are trying to connect 2 DCE devices. Unfortunately, I only have pins for DTEs which is (DB9): Code:
DTECode:
FRC LIRT(The standard is RS-232.) |
Re: Using an FRC with the RCX?
Quote:
I'm going to look up some info on the RC to computer protocol. |
Re: Using an FRC with the RCX?
Got it!
Thank you B&B Electronics! Code:
FRC LIRTThe pins are as follows (DB9): Code:
Shell Shell (optional)So if anyone fries something doing this, please tell us before we fry something! |
Re: Using an FRC with the RCX?
Quote:
You'll have to wait until tomorrow for the info. Sorry. :) |
Re: Using an FRC with the RCX?
Two questions:
1) What kind of hardware would I need on the receiving end to make this work? 2) Has anyone tried to accomplish this successfully? Thanks, I would have never thought of trying something like this! |
Re: Using an FRC with the RCX?
Quote:
Quote:
|
Re: Using an FRC with the RCX?
Here are a few links:
Packet description: (includes example of sending IR message) http://graphics.stanford.edu/~kekoa/rcx/protocol.html From this website, I think that sending: 55 ff 00 f7 08 M ~M C ~C Where C is the checksum. Sends the messageM. One thing I'm confused on is the checksum. It doesn't seem to work the way I read it in his description. Even trying to figure the checksum using his example I didn't come up with the same thing he did. It may be I just don't understand it. If you kow, tell me how to compute it. Some more stuff on the packets: (not as good) http://graphics.stanford.edu/~kekoa/rcx/#Protocol Do you need to know how to send that out, or do you already have that figured out? --EDIT-- Here is a site with examples of using it in C++. http://www.generation5.org/content/2001/rob08.asp. Reading that, it's a great site. :) |
Re: Using an FRC with the RCX?
Quote:
Quote:
Quote:
|
Re: Using an FRC with the RCX?
Quote:
A message packet is only one additional info section. Header (3 bytes) OpCode (2) Message (Info, 2) Checksum (2) The OpCode for Message is 0xF7. It has one argument: the message value. Every data byte is followed by it's not. So you get: Header = 55FF00 OpCode = F708 Message = M ~M CheckSum = (F7+M) & FF I think we're finally getting it! The second link is extremely helpful. And I'm glad to know about the Null-modem cable thing: The LIRT is CTE, not a CSE (it is a male, like your computer), so maybe a standard cable works! |
Re: Using an FRC with the RCX?
You said the prog port earlier, but how do we access that? Or, rather, can we get enough control to do what we want? You can send text, but I haven't studied the printf() access of the port. Maybe that port will work or maybe something else is necessary. Correct me if you know the way. :)
|
Re: Using an FRC with the RCX?
Quote:
I looked in printf_lib.c I traced the flow of execution from printf(), and ended up at Write_Byte_To_Uart(). Which is: Code:
/*********************************************************Code:
#define SendByte(Byte) {TXREG = Byte; Wait4TXEmpty();}You call this repeatedly to write the whole packet. Of course, You can't recieve: the LIRT only remains active for 3 seconds after you transmit something. Also: this whole setup is unusual, so if it doesn't work, don't worry. We just may end up buying a pair of UART DTEs and making a double box! ;) |
Re: Using an FRC with the RCX?
Quote:
And the macro looks fine. :) |
Re: Using an FRC with the RCX?
Neither do I. I just read the file. It's aparently easy!
|
Re: Using an FRC with the RCX?
2 updates:
1. Found gray cable setup. Code:
GRAY CABLECode:
From front:Get the idea? 2. What's the TTL output? I was thinking of the possibility of connecting through that. The prog port is used for so much else! |
Re: Using an FRC with the RCX?
Quote:
Quote:
|
Re: Using an FRC with the RCX?
I know that its probably more fun to reverse-engineer it, but have you guys thought about talking to LEGO for the specs? I know that they sponsor team 96 and I think their mindstorms engineers work with them.
|
Re: Using an FRC with the RCX?
Why? all the reverse-engineering and spec-finding has been done for us. The most reverse-engineering I've done yet is putting a continuity tester to the original gray cable! And RS-232 has been standardized to death, so it's the easiest protocal to use (at either end!).
|
Re: Using an FRC with the RCX?
The TTL port uses the same transmission format as RS-232 (low start bit, 8 data bits, high stop bit). So if you take a 3-pin cable and attach it the Tx, Rx, and Gnd pins on a DB9 female connector, you can use TTL port instead of the prog port. The macro would need to be changed slightly.
Odd, ifi_utilities.c and printf_lib.c both use 'TXREG', but ifi_picdefs.h defines 'TXREG1' and 'TXREG2'. |
Re: Using an FRC with the RCX?
Quote:
|
Re: Using an FRC with the RCX?: Revision B TTL cable
Use this cable for connecting to the LIRT:
Code:
LIRT TTL/DigThe Pin Equivalents are: Code:
3 TTL.RedSpecific info on what to send can be found in the Mindstorms SDK. (Use v1.5 I believe) |
| All times are GMT -5. The time now is 15:17. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi