Programing language advise: Spin or C?
Ragametal
Posts: 8
I'm new to the propeller, and to microcontrollers in general, and I'm in the process of selecting a programming language for my quickstart board. I know that several programing languages are available for the propeller: ASM, Spin, Stamp & C. Since i have no time to learn all of them i would like your opinion on which language do you think I should learn first.
I know that ASM is the most powerful language since it works at a lower level, but it so complex that i decided not to try it for now. Most of the written books focuses on the spin language but the latest tutorials from parallax are based on C, which implies that this might be the preferred language for future propeller development. I'm familiar to C language since I took a beginner's programming class in college some years ago but I'm open to learn spin if you think its a better programming language for the propeller.
Also, it seems like with C I will be able to use external memory modules for big programs, if I need to, but my main concern is that there is a huge library of objects available for the spin language and I don't know if the same is available for the C language. My immediate needs includes interfacing with buttons, LEDS, LCD displays, TV out (text and graphics which I understand may be a problem in spin due to memory limitations) and serial communication with an OBD II module.
So, what do you think? which programming language would you recommend form somebody that is new to propeller?
Thanks in advance for guidance.
I know that ASM is the most powerful language since it works at a lower level, but it so complex that i decided not to try it for now. Most of the written books focuses on the spin language but the latest tutorials from parallax are based on C, which implies that this might be the preferred language for future propeller development. I'm familiar to C language since I took a beginner's programming class in college some years ago but I'm open to learn spin if you think its a better programming language for the propeller.
Also, it seems like with C I will be able to use external memory modules for big programs, if I need to, but my main concern is that there is a huge library of objects available for the spin language and I don't know if the same is available for the C language. My immediate needs includes interfacing with buttons, LEDS, LCD displays, TV out (text and graphics which I understand may be a problem in spin due to memory limitations) and serial communication with an OBD II module.
So, what do you think? which programming language would you recommend form somebody that is new to propeller?
Thanks in advance for guidance.
Comments
Everybody knows what I will say, not Spin, not C, but Forth, it is interactive, very fast, very compact, and "very fun".
My advice? Use Spin unless you need a serious language that will easily transfer to other areas of interest like other micros, etc.... If you have a huge application to write, well stick with Propeller and C or move to another solution.
If you want to write programs that you won't be able to read in a few months, that solution is available too
Yes, for those who do not know how to write in the first place this is most definitely the case. If you can't write you'll never get it right, right?. Of course you can never make a mistake with a connect-the-dots language
Personally, I'm concerned about community fracture. It seems that we forumistas are slowly falling into routines of "if you had only done it with my language then it would be easy like this."
You should take a look around at the various posts and documentation, and make the decision for yourself. Each language has it's pro's and con's, and only you can figure out which has the most value to you.
There is no right or wrong answer to your question and none of us can make the final decision.
Have fun!!!
Since the ABot tutorials are in the C-language, that is the language I started with. Then I got a good deal on a QuickStart Board, and when I searched the site I found a number of tutorials for the QS Board on the Parallax Semiconductor site. They were in Spin. I also found the kickstart tutorials for the QS and Prop Education manual exercises, both in Spin. So I started learning Spin.
Then I read the various Forth threads in these forums, and got really interested in forth.
So I'm using C with the ABot, primarily because of the ABot libraries. I'm using Spin with the QS, and after I do a Spin exercise, translate it into Forth and expand it. Based on my limited experience, Spin is most suitable for taking advantage of the Props capabilities in the easiest way. The language was designed around the microprocesser's features. Support for C for the Prop is still a work in progress, with new tutorials being released and developed.
But I enjoy using forth the most. I'm using pfth, because that is essentially standard forth with some Prop functions added. The other forths are not as standard, but have more Prop features built in. I expect that I will use them more in the future.
Since I'm doing all this as a hobby, I don't have to worry about being efficient and can work with 3 languages at the same time. If there were some PASM tutorials, I'd probably try that also.
Tom
I was talking about Brainf**k. I'm sure you can read your favorite language in a month regardless of what it is.
Absolutely!
We certainly don't want propeller to become a one language MCU
BF has come up as many times as forth, but only one person ever thought BF had merit.
I don't agree with it either, but Ken is consistent in his message.
Twelve replies so far and only eight different suggestions!
Spin.
No question about it.
Spin is the Propeller's "native" language.
It was designed to work with the Propeller and the multiple cog architecture.
The Spin interpreter is already aboard - in the ROM.
Besides that, you'll find a lot more help available for Spin than any of the the other languages.
The down side is that Spin is a pain in-the-butt to work with sometimes.
That indented structural mechanism would not have been my first (2nd, 3rd,4th, 5th, etc...) choice.
But that's really a minor issue.
It it what it is.
So use it.
Like any good programming language it is easy to learn, and hard to master.
It is more readable that C (for the most part), and therefore more maintainable.
again imho.
But that's what you asked for, wasn't it?
Actually, David, it does make sense.
Educators focus on prepping kids to work in industry where C is the paradigm of choice.
They may wind up using Propellers, but probably not.
There ARE a lot of other processors out there.
Commercial users ARE using Propellers.
It makes good sense to use Spin on a Propeller.
You should start with a BS2, this will allow you to get familiar with micro-controllers in a not-so-intense way.
The propeller will bend you over and make you its beetch.
I started on a BS2.(learned basic with tons of forum help)
I then moved to a SX, (learned sxb with forum help)
Then I moved to a propeller(learned spin with little forum help)
My previous bs2 and sxb prepared me well, not to mention parallax has some pretty darn good interpreter language engineers, they keep making new languages and chips that mesh very well.
(you will see that parallax has a language development "style")
The only reason to jump into a prop right away is if you need to play music, or use the VGA or RCA video hardware on the prop.
The total investment for the bs2 AND a propeller is so little that i'd buy both and try both languages.
The bs2 gets users very familiar with the Parallax engineers style of language development.
The sxb language was similar to basic2.5 and spin seems similar to sxb.
Sxb and the SX chip existed when I started on the BS2, I decided to not go with the sx chip due to its much higher learning curve.
The prop chip also requires extra electronic parts(eeprom, crystal, resistors, prop programmer, 3.3v regulator)
The bs2 requires 6-9v DC input, and serial cable(db9 port).
Because microcontrollers are becoming as powerfull as our 80's and 90's computers, the microcontrollers are completely replacing devices and computers (and their c program) with a simple carrier board and a prop chip.
My work uses over 8 BS2 chips on carrier boards located inside an unmarked box at the base of multiple radio towers, to monitor switch inputs, and then operate relay outputs, for radio station audio feed paths.
The more versatile you are in development languages, the more your co-workers will hate you, and call you a brown nozer for providing your boss with so many micro-controller designs to solve real-world needs.
Learn PBasic2.5, then SPIN, then after you know what these micro-controllers are capable of in their own native languages, then i would say try out some propGCC.
Oh, you already have a prop chip and board. In that case learn SPIN.
The amount of objects in the obex is amazing, and will be your #1 web-bookmark eventually.
I still have yet to find 1 other microcontroller out there(even the stamps/sx) that has such a large, very well organized database of code snippets that is all opensource!!!
Hey parallax, can you provide us with a regularly updated, link, to a ZIPPED package of the entire OBEX?
Many of us do development on pc's that are not net connected. I have run spiders, but most do a crappy job.
ALL HAIL THE OBEX
http://obex.parallax.com
1) Parallax proposes C for use by educators, or it at least seems to be what they want.
2) Spin is proposed for use by commercial customers, i.e. industry.
3) The educators are prepping kids for industry.
You see the contradiction here?
I find the whole idea of pushing a chip into industry with Spin as it's backing a bit weird. The bulk of the worlds engineering does not want to mess with YAFL in the form of Spin.
On the other hand I do think that Spin is a wonderful thing for quick and easy hacking and as an introduction to programming and micro-controllers for beginners.
I would encourage anyone getting into micro-controllers to learn C. I would also encourage them to us the Propeller because it is so easy to get started with and powerful. Whilst they are at it take a while to look at Spin. It's an education in language/system design in itself even if you never use it. Anyone who has learned C can pick up Spin in no time, they are conceptually much the same.
Everybody mentioned that the big plus for spin is their huge objects library and that it is the default language for the propeller which means that its very well supported.
The plus for C is that is a cross-platform language that has been adopted by many educators and other micros, not to mention that I have some limited experience with it, but its development on the propeller should be considered a work in progress, meaning that support may be limited.
Forth... well, it sounds interesting but I just wouldn't jump on it at this time since i'll rather focus my learning efforts into a more mainstream language because time is a luxury that sadly I don't have anymore (Learning about micros is a hobby that i'm learning in my spare time).
Based on all this, it seems that my best choice is to learn spin. My main concern at this time is that support for spin seems to be shifting towards the development of C, am I right or is this just my perception? Also, do any of you know which language is better at dealing with external memory?
Lastly, I want to thank all of you for the responses provided so far.
I would not worry about starting an argument. We're all programmers here and there is nothing programmers like more than a programming language bun fight. It's all in the best possible taste. This is the first such language debate this year, there will be many more I'm sure.
If you program long enough you will get annoyed by pretty much every programming language eventually. That's why programmers keep inventing more of the damn things.
I would not say C for the Prop is a work in progress. It has been working very well for a long time. Admittedly there are probably a lot less useful C libraries around for the Propeller than Spin objects.
Don't worry about support shifting away from Spin in the future. I'm very sure Chip Gracey is determined to develop it further as the Propeller 2 chip comes along. There are, as you see, a lot of happy Spin users here and they are the people providing support. That's where all those useful Spin objects come from.
Re: External memory. Depends what you mean. You can access external RAMs and ROMS, both serial and parallel devices, from C and Spin. At least as far as storing data is concerned. Spin however cannot execute code from or store program variables directly in external memory. C on the other hand can do that. That may only matter if you anticipate needing more space than the Propeller HUB provides.
Quite so.
C and Spin enthusiasts must join forces and stand firm in their belief in structured programming against the increasing onslaught of the mutant Forth zombie army.
Oops, getting a bit carried away there.
I begun to use the Propeller with Spin and like it.
But now , my choice would be C.
In fact, when a I build bots with groups of kids : it is clear that their teachers don't know Spin and prefer C (and boards using C).
It is not my choice but the teachers choice .
Also, recently I used the GCC compiler with no big problem .
But don't find large libraries as in the Obex. And puting C libraries in the Obex is confusing.
I think that we need a place with only C libraries for the Propeller.
It will make GCC easier to use.
Jean Paul
: helpful_guys mutant_Forth_zombie_army ;
There, now in the future, you can just call us "helpful_guys".....with Forth, you can change the past and/or prepare for the future!