Society of Robots - Robot Forum
Software => Software => Topic started by: Builder1 on July 02, 2008, 03:51:09 PM
-
Hello Everyone,
I am new to building robots and have never written programs for one. I've read somewhere in this forum that VB can not be used to program a bot, if that is the case, can I use C++? Also ,if my algorithm is too lengthy and can not fit on a micro controller, what other options do I have aside from a laptop? Please respond as best you can, thank you in advance for your time.
-
microcontrollers can only be programmed in assembler. as long as there exists a compiler of your favourite language for the microcontroller of your choice, you can program your microcontroller in that language.
if you run out of space, you can always share tasks between two (or several uc). Memory space and program space cover a broad range, from tiny devices like PIC10 to huge devices like the ATXMEGA or ARMs.
Don't worry, if you never worked with ucs before, there won't be a case yet where you algorithms will even exceed half of the program space.
-
Don't worry, if you never worked with ucs before, there won't be a case yet where you algorithms will even exceed half of the program space.
This might not be true if he's coming from a software engineering background and has some fancy image processing algorithm or something that he wants to implement on a microcontroller. When I first started using microcontrollers I was using floats all over the place and was then very surprised so suddenly have no programming space left. It was somewhat of a surprise to learn that my approach to embedded programming would be quite different from my approached programming on computers.
- Ben
-
depending on what you need the UC to do, you might try looking into a language called brainfuck. im dead serious thats the name, and its a crazy little language, but if you get good at it its very useful.
-
Nice... :o
The C language is likely the most common choice for microcontrollers, followed closely by assembly (arguably first), C++, and basic. AVR has a huge C/assembly based community because the IDE, compiler, and libraries are free. I suspect the same is true of PIC as well, but I've not used them.
Learning C is certainly a more "transferrable" skill to other programming tasks you may need to do in the future. Its basics are largely the same across all platforms and there are a few, very comprehensive, and somewhat "standardized" libraries available for a wide variety of platforms.
Interpreted languages generally don't fare well on microcontrollers because they tend to be less efficient from a resource utilization perspective, so languages like java, perl, lisp, etc. are uncommon.
The key is to pick a language where there is a large community of interest for your platform. This way, you'll find that there are a good number pre-written libraries and code samples to help you learn.
Good luck.
-
PBASIC is easy to learn, but the Basic Stamp 2 MCU is $50, unless you get the OEM version, or can breadboard the circuit.
-
If you ever run out of memory, you'd typically just get a microcontroller with more memory. With careful programming, memory shouldn't be a problem except on the smallest of microcontrollers.
http://www.societyofrobots.com/robot_faq.shtml#robot_language
-
It's always best to find a microcontroller that has a related IDE with a compiler. Assembly language is so close to the hardware that it takes a huge amount of steps to do anything and that is frustrating. The most common higher language is C and works well. C++ will likewise probably be supported by your compiler. Now the trick is how simple is the complier and IDE. Microsoft's Visual C# is not an easy IDE to master and will consume a lot of time and effort to learn. For the hobbiest it's better to adopt a package like the Arduino Uno and associated compiler software. You don't have the memory manage and language shell to deal with. You just program in two functional areas (setup and loop). Likewise, there is display and serial interface software like Processing to provide a great interfac to the controller. Both are free. Processing is written in Java, so it has a sophisticated look and feel to it, thus a small learning curve. Bottom line is C/C++ based IDE that match your controller board is what you want. If you have the money, you can adopt the Texas Instruments controller and have it all. The GUI interface is rich and very well planned out. The controllers are much more sophisticated and have nearly infinite cabability (upgrades, auxillary satellite boards, etc.). But, you have to become familiar with a complex assemble code to see the details or wander away from the GUI IDE.