Noob question <SOLVED>
Hello,
I am working on a laptop-based robot, and I would like to interface the propeller to it for sensor/motor control. Could I have a setup where my laptop can just tell the propeller "Have cog 1 loop until this condition, and let me know when it is reached. Now make cog 2 drive both motors forward until I tell it to stop." etc... What possibilities are out of the question? Thanks!
Post Edited (jknilinux) : 3/18/2008 8:58:29 PM GMT
I am working on a laptop-based robot, and I would like to interface the propeller to it for sensor/motor control. Could I have a setup where my laptop can just tell the propeller "Have cog 1 loop until this condition, and let me know when it is reached. Now make cog 2 drive both motors forward until I tell it to stop." etc... What possibilities are out of the question? Thanks!
Post Edited (jknilinux) : 3/18/2008 8:58:29 PM GMT

Comments
How does the Hyperterminal/full duplex serial connection work, and how do I set it up? Or, how do I make the propeller a slave USB device? Sorry, I'm a bit of a noob with microcontrollers. Thanks!
cmd := Serial.rx if (cmd == "F") GoForward elseif (cmd == "R") GoBackwhere Serial refers to the FullDuplexSerial object, and GoForward and GoBack are your own routines that do the actual moving.
-Phil
Update: Of course that's Serial.rx, not Serial.getc. So much for memory.
Post Edited (Phil Pilgrim (PhiPi)) : 3/18/2008 6:23:26 PM GMT
The programming USB interface can be used for serial comms because it emulates a serial port at the PC end.
Graham
I should finish my program that is slightly better than hyper terminal for others to use
Thanks for the help, but can anyone give me a quick example or how-to with the full duplex serial object/USB interface?
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 OBJ SER :"Fullduplexserial" pub start | TEMP_data temp_data := 100 SER.start(31, 30, 0, 9600) 'Sets up Com port for computer (Rxpin,TXpin,mode,baud) repeat waitcnt(100_000 * 20 + cnt) ser.tx(10) 'line feed ser.tx(13) 'carriage return ser.str(string("Results = ")) ser.dec(TEMP_data) 'display decimal value of temp ser.str(string("binary value is ")) ser.bin(TEMP_data,16) 'display binary value of temp ser.tx(13) 'line feed ser.tx(10) 'carriage returnmake sure you have the Fullduplexserial object
CON _clkmode = xtal1 + pll16x 'set clock frequency _xinfreq = 5_000_000 OBJ serial : "FullDuplexSerial" 'fullduplexserial object PUB main serial.start(31, 30, 1, 9600) 'start fullduplexserial on the programming pins, with inverted communications, at a baudrate of 9600 serial.str(string("Hello World!")) 'transmit the string Hello World!This code will work with the default hyperterminal settings.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1010, so be surprised!
How could I make the computer talk to different Cogs, though? Great answers!
-Phil
Post Edited (Phil Pilgrim (PhiPi)) : 3/18/2008 7:23:09 PM GMT
-Martin
You have a good point, martin, and I will start small. I was just asking these questions to see if it what I wanted to do was possible, before I buy a whole propeller dev kit. Last question: How hard will it be to do all this? I don't want to be working on communication for two weekends or something. Sorry about the newb questions... Thanks!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
I am 1010, so be surprised!
Seriously, it sounds like a worthwhile goal, regardless of the time spent. Besides, if any of us knew ahead of time how much was involved with the projects we do, we probably wouldn't start most of them! Such is life.
Good luck with your project!
-Phil
tell us about your programming skills on PCs. This will help to adjust the level of the answers that were posted here in the forum.
Minimum would be to answer with one o the following choices:
a.) i'm a complete newbie to programming at all on PCs and for microcontrollers
b.) i made some simple programs in a high level language like visual basic, delphi, java
c.) i made quite a lot programs in a high level language like visual basic, delphi, java
d.) i have developed a lot of applications in c/c++ using the windows API but never programmed a serial connection
So make a choice for one of the letters a-d.
Even better would be to answer in complete sentences what kind of programs in which language you made on a PC
It's sure possible to start learning programming with SPIN - the propellerlanguage.
But it will start with lower things than controlling a robot.
Your former questions showed that your understanding of the propeller is not very deep.
That's REALLY REALLY OK. But asking for quick examples for controlling a robot is NOT possible, because this is a quite complex thing.
There are NO QUICK examples for doing that. Except somebody has finished a project and could paste "quickly" his complete sourcecode
which will have hundreds or thousands of commands in summary.
Without a deeper knowledge about programming and the propellerhardware you would be only able to rebuild exact the same robot
loading up the software and maybe making small changes like changing some words showing on a LC-Display
If you ask for specific and concrete details you will get a lot of help here. As long as we (all the other members of the forum) can see
that YOU thought about the last answer and made some steps forward BY YOURSELF and then comes up a new but CONCRETE question
you can ask three times every day and you will get answers.
I guess most of us do not like to write a one week tutorial about programming a robot as ONE PIECE for you.
And even then it would not be clear where your specific problems are. Maybe the tutorial would say a lot of about things you know
very well and things you do not now are short in two sentences. So the best way is if you are asking very CONCRETE questions
best regards
Stefan
I have some experience with C, C++, Java, PBasic, and Assembly, but never used I/O such as serial ports. I certainly never wanted anyone to write a one-week tutorial; when I asked for a small example I meant 5 lines of pseudocode. Sorry about the dumb questions. I know my understanding of the propeller will improve when I get one. Thanks!