Shop OBEX P1 Docs P2 Docs Learn Events
Spin and C — Parallax Forums

Spin and C

hacktorioushacktorious Posts: 72
edited 2013-12-29 17:00 in General Discussion
I've read some posts pertaining to Spin vs. C. However, I'm not certain I see much of an advantage of using Spin. I currently already know C and use it to program Arduio.

Is it really worth learning Spin just for the Propeller? I guess a good question would be, what can I do with Spin that I cannot do with C?

C seems to be much more of a standard than Spin as well, which is another major factor.

I do know Python and Ruby, and spin seems somewhat similar.

Any thoughts?

Comments

  • xanaduxanadu Posts: 3,347
    edited 2013-12-29 12:37
    Should I learn SPIN instead of __________ to do ___________ possibly starting with __________ code?

    Not so easy to answer... Search the forum or google spin vs C, and you'll see it has been brought up a lot.

    IMHO, use C and while you're at it, try SPIN anyway :) You don't have to master all of SPIN to do common tasks and there are tons of example code.
  • rod1963rod1963 Posts: 752
    edited 2013-12-29 12:38
    SPIN is tied to the Prop. If you are only going to be working on Props and nothing else it's fine to learn Spin. But if you're planning on one day coding for AVR's, PIC32's or ARM's, learn C. GCC is also available for the Prop so you can't go wrong this way either.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-12-29 12:47
    If you have read the previous posts (a couple within the past 2 weeks), I think the topic has been covered quite well. If you have specific comments or questions about items brought up in those threads, I'd ask in those threads.

    There seem to be a lot of Spin vs C threads that if you read through them, most questions should be answered.

    I'm not picking on you, your PEK questions were specific to a problem you were having and good posts that would be hard to search for but it seems like every week or so we go through the this vs. that questions that could be searched for.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-29 13:09
    what can I do with Spin that I cannot do with C?

    You can use all the code in the OBEX which is no small thing.

    If you know C what's it to learning Spin? Drop the brackets and semicolon and remember to use "=<" not "<=".

    I used C a lot before using the Propeller. I was soon glad to be rid of the brackets and semicolons.

    Ken Gracey recently mentioned all their commercial uses of the Prop use Spin and PASM. C is to keep the educational sector happy.
  • jazzedjazzed Posts: 11,803
    edited 2013-12-29 13:13
    Lots of people here love SPIN. I like it too. I know SPIN because when I started programming propeller in late 2007 it was the only Propeller language in town besides PASM (which I also like).

    Learning a new language will make you better programmer. If you start throwing up uncontrollably while writing a program ... well at least you'll know better next time.
  • Heater.Heater. Posts: 21,230
    edited 2013-12-29 14:08
    Practical matters:

    1) I believe Spin still produces smaller code than the C compiler for the same functionality.
    2) When you need speed the PASM assembly language is an integral part of Spin. It's so much easier to use that the C/asm combination and the PASM syntax is nicer.
    3) There is the OBEX repository of ready made objects every thing from serial communications to VGA graphics to sound synthesis etc.
    4) The Prop Tool is about the simplest quickest programming environment ever. Or use BST or now SimpleIDE.

    If you know C you owe it to yourself to spends a few evenings studying the Propeller manual and Spin and PASM. What you don't get from these discussions is the sheer elegance of the whole system from the Prop hardware architecture, the instruction set, the assembler language the Spin language the integration of the whole all the way to the Propeller Tool. It's a great lesson in design. Worthy of a little study even if you end up not using it.
  • hacktorioushacktorious Posts: 72
    edited 2013-12-29 15:08
    Thanks for all the good input.


    Is it possible to access multiple cogs with C? I've not found much good info on this. Thanks.
  • jazzedjazzed Posts: 11,803
    edited 2013-12-29 16:07
    Oops, question edited away ....

    In propeller-gcc anytime you use cogstart or cognew, you're getting access to multiple cogs.

    The cogstart function is used to start a C function running in a COG.
    At this time cogstart can only be used with CMM/LMM modes.

    The cognew function is used to start a PASM, GAS, or COGC program.
  • hacktorioushacktorious Posts: 72
    edited 2013-12-29 16:16
    Thanks for all the good input.
  • hacktorioushacktorious Posts: 72
    edited 2013-12-29 16:19
    jazzed wrote: »
    Oops, question edited away ....

    In propeller-gcc anytime you use cogstart or cognew, you're getting access to multiple cogs.

    The cogstart function is used to start a C function running in a COG.
    At this time cogstart can only be used with CMM/LMM modes.

    The cognew function is used to start a PASM, GAS, or COGC program.

    Thanks. I'm reading through the links you have in your signature. This looks like great stuff, however, I feel the C stuff is lacking in documentation compared to spin.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-29 16:25
    I feel the C stuff is lacking in documentation compared to spin.

    Propeller C is still new.

    It is in it's Beta stage after all.

    Parallax seems to be gung ho on C. The ActivityBot only has lessons in C.

    It will be interesting to see which becomes more commonly used Spin or C.

    I like C but I like Spin more.

    I have links to Spin (and PASM) tutorials in post #3 of my index (see signature).
  • jazzedjazzed Posts: 11,803
    edited 2013-12-29 16:34
    Duane Degn wrote: »
    Propeller C is still new.

    It is in it's Beta stage after all.

    No. Propeller-GCC version 1 is released. There are on-going updates getting ready for P2.

    SimpleIDE is in production and will have more refinements.

    Parallax has full tutorials for Propeller-C. More will be added as time goes on.

    Parallax has invested effort in Propeller-C because their largest market requires it.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-29 17:00
    jazzed wrote: »
    No. Propeller-GCC version 1 is released.

    Apparently I haven't been keeping up with this aspect of the Propeller.

    Thanks for the correction.

    I'm sure I'll take the plunge into learning Propeller-GCC but I've just grown very fond of Spin.

    I do have several projects which would benefit from being able to use larger programs. I purchased one of Parallax's Propeller Memory Cards in preparation of experimenting with C.
Sign In or Register to comment.