![]() |
Interfacing a second Micro to the RC
Does anyone out there (rbayer, wildstang...) have some code samples to post on how they passed information back and forth between their custom micro and the Robot Controller. Looking at different Micros such as the HC11 (12) and other and wondering if any of them are better or worse at talking with the RC.
Any help would be great |
Outline of my solution...
I used a stamp2 as my "coprocessor" this year.
It worked out ok but there were difficulties. The main thing had to do with the Programming port from the Stamp2 on the RC echoing back any character that I sent it. This was a MAJOR pain in the rear. The only way I could get it to work was to use the programming port as my RC -> CO-Processor path and to use the digital input port on the RC as my CO-Processor -> RC path. Once I figured this out, I still was not out of the woods because I discovered that in the worst case conditions there is a 3 data packet delay from the data being put onto the digital input port and the Master CPU on the RC passing the data to the Stamp2 on the RC. I spoke to Innovation First folks about this a bit and they were not very helpful to be honest. In any case, here is the scheme that I developed that worked for me. #1 I would send out a data request or other command (for example, zero all counters or give me CG position data) by asking for one of 16 "addresses" via the programming port of the RC stamp2. #2 4 pins of the digital input port were then devoted to the address of the data that was put on the port (this limited me to 12 bits of data per transfer, but it was a reliable handshake method). #3 The RC Stamp2 would only request a new address after the address it got back from the digital input port matched the address it had requested. This worked pretty well. Note that the coprocessor Stamp2 had some counter circuits and a latch/shift register in order to do the fast work of keeping track of wheel positions (a Stamp2 is not really capable of keeping track of left and right wheel positions at the same time yet alone communicate with another Stamp2 via serial data while doing it -- the counters did all the time critical work and the Stamp2 just read the counters at its leisure). I hope that Innovation First comes up with a better system next year, but if they don't, I would use the system we had this year again without hesistation. Joe J. P.S. The only thing I would do is improve some of my routines on the co-processor Stamp2 to do more stuff. I had plans to have the co-processor keep track of CG velocity (direction and speed) and to compute a "virtual Yaw Rate sensor" as well as a few other things but never got around to it. In the end, all I needed from the co-processor was distance the CG moved since reset and angular orientation relative to orientation at reset. Not too sexy but enough to get to the stack in sub 3 second times. |
Re: Outline of my solution...
Quote:
To solve the "echo" problem, we created command bytes that were reserved (i.e. only the RC could send them - before the uC sends out a byte, it ensures that the byte doesn't match any of the command bytes). This way, the interrupt service routine on our microcontroller can safely assume that any byte that's not a command byte is an echo and discard it. We do this by checking the outgoing byte in our SendByte routine on the uC and rounding down any value that matches a command byte (also we have no sequential commad bytes). Here's the relevant RC code: Code:
'==========================================Well hopefully this gives you something to noodle over. Let us know if we can provide more info or help! |
This year, our team (alpine robotics) used the HC11 in a custom circuit designed to monitor the position of the translational drive wheels. We did our communication to the RC through the programming port, and the interfacing was relatively straightforward.
To correct the echo byte, we just programmed the HC11 to discard the first input that it recieved after sending the output, and we had no problems. Our biggest problem was that the RC is slow, so that the RC would not be able to receive data in time. This was fixed with a delay in the HC11 program. We also had other minor problems due to wiring. Once we forgot to cross pins two and three, which are transmit and recieve. When the custom board is connected to a serial port of a computer, these pins are crossed inside the computer's wiring, but when the custom circuit is connected to the RC, you must cross them yourself. Also, for some reason that I forget at the moment, we had to connect pin 4 to ground as well as 5. I still have all our resources, including the PCB schematic, the assembly program, and I think our PBASIC program is on the white pages. Contact me if you want any of those things. -Bobby Sakurai |
| All times are GMT -5. The time now is 15:43. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi