Commiunicating [PC to Propeller] then [PC to Microcontroller to Propeller]
stevetronik
Posts: 15
What i have here is a propeller demo board. the propeller demoboard is connected to control a robot thru P2.
What i have managed to is to control the robot from the PS/2 keyboard and mouse driver that are connected to the propdemoboard, with displays information on the VGA text.
I want to attempt in doing a control interface on the PC (likely using hyper terminal or written C programs, suggestion for others are welcome) to achieve something like a control and monitoring interface on the PC to the propeller to the robot.
Equipments that i have are, Propeller Demo Board, USB to Serial Com (comes with prop), USB to RS232
What pins can i use, and what drivers are available to be use.
Thanks in advance
Steve,
What i have managed to is to control the robot from the PS/2 keyboard and mouse driver that are connected to the propdemoboard, with displays information on the VGA text.
I want to attempt in doing a control interface on the PC (likely using hyper terminal or written C programs, suggestion for others are welcome) to achieve something like a control and monitoring interface on the PC to the propeller to the robot.
Equipments that i have are, Propeller Demo Board, USB to Serial Com (comes with prop), USB to RS232
What pins can i use, and what drivers are available to be use.
Thanks in advance
Steve,
Comments
When the downloading of the code has finished you can open the virtual comport - that is provided through the USB-connection to the demoboard -
by any PC-software that is able to talk to a comport. And then you simply send and receive bytes from/to the propeller.
here is a small example-code
Have a look at this PDF ocument and·have a look at this posting in this forum.
I think with both these links along with·Stephan's program you should have a GOOD head start.
Good luck
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Samuel
www.RobotBASIC.com
Post Edited (SamMishal) : 1/16/2010 5:37:10 PM GMT
In doing a design like this I recommend first creating a list of what data is going to go from the PC to the Robot and then from the Robot to the PC. Think through commands like move forward, left, creep, fast, stop, reboot, etc. Also think through data like sensor feedback, position, object detection, etc. Does the robot just send data all the time or does it only send data when requested too by the PC? Once you have data/commands listed you can then create some protocol or packet format. Don't get discouraged by these words, they simple mean setting up and describing how the data is transfered so that the robot and the PC both understand the data. Start easy with a SerialTerminal/FullDuplexSerial objects. Get data to show up in a terminal application first. Once that works you can then upgrade to an application and program it in any language that can access the serial port such as VB.Net, C, Java, Realbasic, etc.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Timothy D. Swieter, E.I.
www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" LCD Composite video display, eProto for SunSPOT
www.tdswieter.com
EDIT: I would like to mentioned that my Microcontroller's is using an UART port.
Advice is greatly appreciated
Steve,
Post Edited (stevetronik) : 1/20/2010 3:01:13 AM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
···································Fix it, if ain't broke!
D Rat
Dave Ratcliff N6YEE
www.robotbasic.org/resources/RobotBASIC_To_PropellerChip_Comms.pdf
Sample Text:
"The Propeller Chip (propeller) is a an advanced microcontroller that can be programmed using Assembly language or a fascinating and pleasure to use proprietary language called Spin. We shall develop programs to achieve serial communications between a PC running a RobotBASIC program and the propeller running a Spin program.
The article will not attempt to explain the nuances of Spin. You are assumed to be familiar with Spin and the propeller. However, the article will explain options for connecting the propeller to a PC so as to be able to communicate with an RB program running on it.
The developed programs will be of sufficient complexity to illustrate the communication most likely to be needed with projects that require communicating a PC and the propeller using RB and Spin.
The Layout:
Figure 1 is taken from page 5 in the Propeller Data Sheet and it shows the connection the Propeller Tool (programming IDE) assumes in order to program the propeller.
Figure 1: Propeller Programming Setup (Propeller Data Sheet page 5)"
The program is the SPIN side.....BUT....the RobotBASIC program is included in the Spin code as Comments
just cut and paste it into the RB IDE to run it.
·
Rartronic's program is ALSO a GREAT program.
The PDF also has some nice examples....
I hope all this has been good enough....if you need more let me know.
Here is an image of Jonny's program running
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Samuel
www.RobotBASIC.com
Post Edited (SamMishal) : 1/20/2010 6:17:46 AM GMT
clrbuf in the following segment.
repeat
buf[noparse][[/noparse]bufPntr++] := term.rx
if strcomp(@cmd, @buf)
term.str(string("Propeller here!"))
clrbuf
if bufpntr == 5
clrbuf
isit necessary to do a clear buffer. will something overload if I don't or is it just a precaution. otherwise everything seems fine and fun to 'speak' with prop.
RobotBASIC is awesome but I don't think I would have the time to learn RobotBASIC for the time being, having a tight schedule to follow, the next step would be trying to link up with teammates microcontroller board, probably still figuring out the microcontroller baud rate at the moment.
"What if the baudrate of the microcontroller and propeller don't match, can they still work?"
EDIT: i believe I'm using 115200 br for most cases. If i want to reduce the speed, where in prop and spin should i edit.
Post Edited (stevetronik) : 1/22/2010 5:58:23 AM GMT
If you read my code-example carefully there is precise timing mentioned. The baudrate determines the timing.
You can adjust the baudrate of the propeller to ANY value.
baudrate=13, baudrate=9601, baudrate=9599, baudrate=109678 or whatever you like.
BUT ! the baudrate of two devices HAVE TO BE the SAME. Otherwise the other device will read just garbage.
You need two serial connections. Therefore you start twi DIFFERENT cogs and then it is possible to adjust the
TWO baudrates to any values you want.
best regards
Stefan