Shop OBEX P1 Docs P2 Docs Learn Events
Programing language advise: Spin or C? — Parallax Forums

Programing language advise: Spin or C?

RagametalRagametal Posts: 8
edited 2014-02-17 12:53 in Propeller 1
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.
«1345

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-13 19:22
    Ragametal wrote: »
    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.

    Everybody knows what I will say, not Spin, not C, but Forth, it is interactive, very fast, very compact, and "very fun".
  • jazzedjazzed Posts: 11,803
    edited 2014-02-13 19:39
    Spin is a good beginners language. It will not port easily to other processors like C, but the concepts are similar. C is a heavily typed language designed to be more easily maintained than a scripting language. C for Parallax is a necessity for educational sales (the largest revenue source) because huge swaths of that market will not even consider Spin.

    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 ;)
  • EE351EE351 Posts: 81
    edited 2014-02-13 19:47
    How about the red-headed stepchild of propeller languages, PropBASIC?
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-13 19:48
    jazzed wrote: »
    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 :)
  • SRLMSRLM Posts: 5,045
    edited 2014-02-13 19:48
    I don't think you'll get an unbiased opinion. Each language has it's proponents and it's opponents, and these arguments have been hashed over many times. Parallax recommends that educational users use PropGCC, and hobby and commercial users use Spin.

    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.
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-02-13 19:59
    Different languages are going to resonate with different people for different reasons. Give each candidate an honest trial for a week to see which is for you. After a month or so, you will havlearned a lot more about the Propeller, tried some new languages and been through a bunch of tutorials and forum examples. If you have specific questions about a specific language, a bunch of really helpful folks will jump in to help and probably argue a bit as SRLM pointed out....mostly harmless and good natured banter.

    There is no right or wrong answer to your question and none of us can make the final decision.

    Have fun!!!
  • twm47099twm47099 Posts: 867
    edited 2014-02-13 20:05
    I am also very new to microcontrollers. I got the ActivityBot kit this past December.

    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
  • David BetzDavid Betz Posts: 14,516
    edited 2014-02-13 20:09
    SRLM wrote: »
    Parallax recommends that educational users use PropGCC, and hobby and commercial users use Spin.
    This makes absolutely no sense to me. Saying that hobby and commercial users should use Spin instead of C seems to me to be the same as saying that PropGCC isn't really good enough for hobby or commercial use. If that is the case, it shouldn't be used for educational use either. Why teach someone to program in a language that can't be used beyond education? You might as well teach them Spin or suggest that the students use another processor entirely. I don't see any reason that PropGCC isn't a good choice for education, hobby, and commercial use. I also don't see any reason that Spin wouldn't be good for all of those uses as well given that the user is willing to be open-minded about language choice. I don't believe it's true that Parallax makes this recommendation.
  • jazzedjazzed Posts: 11,803
    edited 2014-02-13 20:15
    Yes, for those who do not know how to write in the first place

    I was talking about Brainf**k. I'm sure you can read your favorite language in a month regardless of what it is.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-02-13 20:22
    jazzed wrote: »
    I was talking about Brainf**k. I'm sure you can read your favorite language in a month regardless of what it is.
    Hey, who uses that on the Prop? I was hoping you were having a friendly dig anyway. So as you said it comes down to what is "your favorite language" and the only way anyone can find out is to try them as suggested. Even the very best language if there were such a thing would not be the best language for everyone.
  • jazzedjazzed Posts: 11,803
    edited 2014-02-13 20:38
    Even the very best language if there were such a thing would not be the best language for everyone.

    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.
  • SRLMSRLM Posts: 5,045
    edited 2014-02-13 21:35
    David Betz wrote: »
    This makes absolutely no sense to me. Saying that hobby and commercial users should use Spin instead of C seems to me to be the same as saying that PropGCC isn't really good enough for hobby or commercial use. If that is the case, it shouldn't be used for educational use either. Why teach someone to program in a language that can't be used beyond education? You might as well teach them Spin or suggest that the students use another processor entirely. I don't see any reason that PropGCC isn't a good choice for education, hobby, and commercial use. I also don't see any reason that Spin wouldn't be good for all of those uses as well given that the user is willing to be open-minded about language choice. I don't believe it's true that Parallax makes this recommendation.

    I don't agree with it either, but Ken is consistent in his message.
  • cavelambcavelamb Posts: 720
    edited 2014-02-13 22:45
    Not too bad.
    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?
  • cavelambcavelamb Posts: 720
    edited 2014-02-13 22:51
    David Betz wrote: »
    This makes absolutely no sense to me. ..

    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.
  • Clock LoopClock Loop Posts: 2,069
    edited 2014-02-13 22:57
    Ragametal wrote: »
    I'm new to the propeller, and to microcontrollers in general,

    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
  • jazzedjazzed Posts: 11,803
    edited 2014-02-13 23:37
    SRLM wrote: »
    I don't agree with it either, but Ken is consistent in his message.
    Propably the most succinct and useful message of all!
  • David BetzDavid Betz Posts: 14,516
    edited 2014-02-14 03:39
    deleted by author
  • David BetzDavid Betz Posts: 14,516
    edited 2014-02-14 03:53
    deleted by author
  • Heater.Heater. Posts: 21,230
    edited 2014-02-14 04:04
    Let me get this straight:

    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.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-02-14 04:08
    jazzed wrote: »
    Propably the most succinct and useful message of all!
    And the most discouraging for anyone who has had anything to do with the creation of PropGCC. And I still maintain that if the Propeller isn't a good choice for developing professional Propeller applications then there is no point in learning C on the Propeller at all. Better to learn it on a platform where your knowledge can be applied beyond just the "simple" educational exercises.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-02-14 04:08
    Heater. wrote: »
    Let me get this straight:

    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?
    Exactly my point. I remembered Ken saying that most commercial applications for the Propeller were written in Spin which makes sense because Parallax has only been supporting C for a few years. I didn't remember him actually suggesting that future commercial applications should also be written in Spin.
  • Heater.Heater. Posts: 21,230
    edited 2014-02-14 04:17
    David,

    deleted by author
    Too late. I saw it. Hope my post above has cheered you up a bit.
  • RagametalRagametal Posts: 8
    edited 2014-02-14 06:01
    I almost feel sorry for asking, it seems that I started an argument instead of a friendly discussion.

    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.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-02-14 06:12
    Ragametal wrote: »
    I almost feel sorry for asking, it seems that I started an argument instead of a friendly discussion.

    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'm glad you were able to find an answer to your question amid the noise and I'm sorry for having contributed to the confusion. I was just surprised by the recommendation that Parallax made about when Spin and C are appropriate choices. I'm sure you'll have a very good experience with Spin. It is well supported here on the forums.
  • Heater.Heater. Posts: 21,230
    edited 2014-02-14 06:36
    Ragametal,

    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.
  • David BetzDavid Betz Posts: 14,516
    edited 2014-02-14 06:47
    Heater. wrote: »
    Ragametal,

    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.
    To be clear, I'm not trying to advocate any language over any other language. I'd just like it to be acknowledged that C is a perfectly viable language for developing both hobbyist and commercial applications on the Propeller. Of course, Spin is as well. They both have their place and they both have their strengths. My only objection was to the statement that C is for education and Spin is for real work. I think either can be used in either context effectively.
  • Heater.Heater. Posts: 21,230
    edited 2014-02-14 06:54
    David,

    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.
  • Cats92Cats92 Posts: 149
    edited 2014-02-14 07:06
    Hello,

    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
  • mindrobotsmindrobots Posts: 6,506
    edited 2014-02-14 07:07
    Heater. wrote: »
    ......against the increasing onslaught of the mutant Forth zombie army.

    : 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! :lol:
  • David BetzDavid Betz Posts: 14,516
    edited 2014-02-14 07:16
    Heater. wrote: »
    David,

    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.
    Yeah but aren't zombies in vogue these days? Maybe we structured language types are the ones who are behind the times. Maybe we should enlist! :-)
Sign In or Register to comment.