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

C or Spin?

ChristianGeekChristianGeek Posts: 1
edited 2013-12-16 17:10 in Learn with BlocklyProp
Hi, I'm new to the Propellor and just received my Activity Board. I'm curious...is there an advantage to programming with Spin instead of C?

Craig

Comments

  • msrobotsmsrobots Posts: 3,709
    edited 2013-12-13 19:58
    welcome to the forum!

    It depends.

    If you already know C it is the fastest way to go. If you do not know C then Spin may be easier to learn.

    Parallax does a huge work in getting C documentation and demos out, but most Source out there for the propeller is in Spin and Pasm.

    Spin is slower than C but uses less memory, thus more complicated programs in Spin might still fit in 32K.

    on the other hand C supports external memory for lager programs and spin does not.

    Spin is made for the propeller and neatly supports the whole concept of the Propeller. It is quite fun to learn and program with.

    so -

    it depends.

    Enjoy!

    Mike
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2013-12-13 21:07
    I had never programmed in C until recently. As a consequence, I embraced Spin and PASM early on and found them both to be incredibly easy to use and great tools for rapid applicaiton development. But if you're already conversant in C, that might be your best on-ramp to Propeller programming. Even then, I would encourage you check out Spin, since I still believe it to be the best overall language for Propeller programming, being the one that was designed specifically for the Prop. Also, Spin's object library (http://obex.parallax.com) far outstrips what's available to date in C.

    -Phil
  • twm47099twm47099 Posts: 867
    edited 2013-12-13 21:40
    I had never programmed in C until recently. As a consequence, I embraced Spin and PASM early on and found them both to be incredibly easy to use and great tools for rapid applicaiton development. But if you're already conversant in C, that might be your best on-ramp to Propeller programming. Even then, I would encourage you check out Spin, since I still believe it to be the best overall language for Propeller programming, being the one that was designed specifically for the Prop. Also, Spin's object library (http://obex.parallax.com) far outstrips what's available to date in C.

    -Phil

    I recently bought an Activitybot, and I have been relearning C using the Simple C tutorials.
    What would I need to get to be able to learn Spin with the Activitybot? And are there tutorials for it the way there are for C?

    Thanks
    Tom
  • Ken GraceyKen Gracey Posts: 7,392
    edited 2013-12-13 21:45
    twm47099 wrote: »
    I recently bought an Activitybot, and I have been relearning C using the Simple C tutorials.
    What would I need to get to be able to learn Spin with the Activitybot? And are there tutorials for it the way there are for C?

    Thanks
    Tom

    We've noticed that since we've started to offer C we have had more people interested in learning Spin. This is great!

    Take a look at the Propeller Education Kit tutorial and the Parallax Semiconductor AppNotes. Also see the Propeller Tool Q&A and Propeller Manual. All of these resources are very helpful.
  • Dave HeinDave Hein Posts: 6,347
    edited 2013-12-14 04:10
    I suggest learning both.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-12-14 06:20
    I think Spin and PASM are the best way to actually learn the architecture of the Propeller, At the microcontroller level it is important to understand the hardware if your really want to exploit the features and/or optimize it. Work through the Propeller Education Kit manual and any Spin tutorials so you at least understand the basics.

    C has it's place as it allows you to abstract your program from the hardware a bit and build some data structures and apply some code designs in a different way than spin. It is also a transportable skill and you want as many of those as you can have in your personal kit.

    There are other routes that folks have taken that let you interact directly with the hardware but you specifically asked about Spin and C, so I won't be the one to take us off topic.

    Do you have any programming background? That can influence the direction you want to take, also.
  • twm47099twm47099 Posts: 867
    edited 2013-12-14 13:33
    mindrobots wrote: »
    I think Spin and PASM are the best way to actually learn the architecture of the Propeller, At the microcontroller level it is important to understand the hardware if your really want to exploit the features and/or optimize it. Work through the Propeller Education Kit manual and any Spin tutorials so you at least understand the basics.

    C has it's place as it allows you to abstract your program from the hardware a bit and build some data structures and apply some code designs in a different way than spin. It is also a transportable skill and you want as many of those as you can have in your personal kit.

    There are other routes that folks have taken that let you interact directly with the hardware but you specifically asked about Spin and C, so I won't be the one to take us off topic.

    Do you have any programming background? That can influence the direction you want to take, also.

    Thanks everyone for the answers. A little on my experience:
    I'm a retired metallurgical engineer, finally with some time to follow up on other interests. In the 1980's I had a couple of computers (Compucollor II and COSMAC ELF). With the Compucolor, I programmed in Basic (built in to the computer), 8080 assembly language, tiny C, fortran, and fig Forth. I also made some hardware add-on's from BYTE magazine interfacing to the 8080 Bus..

    When the Compucolor died (unfortunately the company was out of business) I stopped doing the low level stuff (never got into PC or 8086 programming), but did PDP11 Basic, and Techtronics Basic programming for mechanical test machine control, data acquisition, and analysis. I also did a little Microsoft C utility programming to convert the number formats used by different data acquisition hardware into formats recognized by the data analysis computers. That type of work ended about 25 years ago.

    Last year I bought an Android Tablet and downloaded Forth onto it. I've been using that a lot. Unfortunately, the Android Forth is written in Java and the limitations of Java and Android limit its ability to interact with the machine, but as a programmable calculating system, its pretty useful and fun.

    My wife and I usually give Christmas gifts that are scientific or tech education to our great nephews and nieces. Recently my niece (a teacher) suggested that we give her 8 year old son a programmable robot, and suggested a specific model (not Parallax). I researched robots and found that the BoeBot would be more appropriate, because of the educational/tutorial materials here and the hardware add-ons. While researching, I also found the Activity Bot and the C tutorials, and decided to buy one for myself - to re-learn C and to re-study microcomputer control (using a modern system.)

    I'm part way along the Activity Bot tutorials, and I'm studying the C code in the libraries. I've also read the Propeller documentation and feel that Spin will help me get me a better understanding of how the processor works and of parallel processing (I have no experience in that at all).

    I have very limited knowledge (almost none) in interfacing to controller boards, so this is a very interesting experience for me. I doubt that I will use any of this for anything other than a learning experience, but I also find that I like to take published projects / software and modify them, so who knows?.

    Thanks again,
    Tom
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-12-14 13:57
    Well, you never mentioned Forth! There are three excellent Forths to try on the Propeller (in my opinion, a great way to learn how the hardware works).

    PropForth - see the link in my signature or search for PropForth for some of the "mother" threads. It is very full featured but non-ANSI

    Tachyon which is a wonderfully fast, very Propeller oriented forth also that is still a rapidly changing work. It's also in my signature.

    The newest kid on the Forth block is pfth - which is an ANSI standard Forth that has grown up quickly and is also a good go on the Prop.

    If you enjoyed Forth on your Micros back in the day, these will amaze you!

    So all these choices certainly don't help with your predicament at all! :smile:
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 12:35
    mindrobots wrote: »
    Well, you never mentioned Forth!
    The original poster never mentioned Forth :)

    Following Martin's Rule: Forth can be very compact, if you care to use it.
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-12-15 12:51
    jazzed wrote: »
    The original poster never mentioned Forth :)

    Following Martin's Rule: Forth can be very compact, if you care to use it.

    Ahhh, but someone mentioned Forth!! That's the important thing!! :smile:
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 12:53
    mindrobots wrote: »
    Ahhh, but someone mentioned Forth!! That's the important thing!! :smile:

    You should say some thing nice about the other language every time you go off topic :)
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-12-15 13:52
    I thought I spoke rather nicely of both Spin and C in post #7. Then in post #8, someone else hijacked the thread....I honestly thought it was the same person...honest!
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 13:56
    It's Ok :)
  • twm47099twm47099 Posts: 867
    edited 2013-12-15 14:22
    mindrobots wrote: »
    I thought I spoke rather nicely of both Spin and C in post #7. Then in post #8, someone else hijacked the thread....I honestly thought it was the same person...honest!

    I apologize; I had no intention of hijacking a thread. Simply asked how to go about getting the stuff I needed to learn Spin with my Activitybot, was given some very good suggestions, and was asked about my programming background. I answered and found out that in addition to the Parallax languages C, Spin, and PASM, there was also he that shall not be mentioned. I thought it was a good response since it pointed me to other sources rather than going into detail in this thread.

    Once again, I apologize, and I appreciate the sharing of knowledge in these forums.

    Tom
  • jazzedjazzed Posts: 11,803
    edited 2013-12-15 14:42
    Don't worry.

    There are at least 6 different forths mentioned in the Parallax forum history.

    Parallax does not offer any Learn materials on forth.

    Useful information about forth on Propeller can be found in threads beyond the Learn forum.

    Thanks.

    twm47099 wrote: »
    I apologize; I had no intention of hijacking a thread. Simply asked how to go about getting the stuff I needed to learn Spin with my Activitybot, was given some very good suggestions, and was asked about my programming background. I answered and found out that in addition to the Parallax languages C, Spin, and PASM, there was also he that shall not be mentioned. I thought it was a good response since it pointed me to other sources rather than going into detail in this thread.

    Once again, I apologize, and I appreciate the sharing of knowledge in these forums.

    Tom
  • mindrobotsmindrobots Posts: 6,506
    edited 2013-12-15 15:42
    twm47099 wrote: »
    I apologize; I had no intention of hijacking a thread. Simply asked how to go about getting the stuff I needed to learn Spin with my Activitybot, was given some very good suggestions, and was asked about my programming background. I answered and found out that in addition to the Parallax languages C, Spin, and PASM, there was also he that shall not be mentioned. I thought it was a good response since it pointed me to other sources rather than going into detail in this thread.

    Once again, I apologize, and I appreciate the sharing of knowledge in these forums.

    Tom

    Haha, don't fret! I really did think you were the original poster!

    One of the true joys of the Propeller is that it has several languages available on it that are production quality and let you explore it in many ways. With C it is useable without some folks having to leave gheir confort zones. As stated earlier, Spin/PASM give you access in the 'native language'. While the Activitybot tutorials are written in C, the OBEX (objecf exchange) contains code for most of the Activitybot sub components.

    The activities on learn.parallax.com are a great collecfion of tutorials and regardless of the language they are written in are great learning resource to work through.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-12-15 16:04
    twm47099 wrote: »
    What would I need to get to be able to learn Spin with the Activitybot? And are there tutorials for it the way there are for C?

    I have a collection of links to Spin tutorials (and a bunch of other stuff) in post #3 of my index.

    I think I've even fixed all the broken links caused by Parallax's recent website change.

    One nice thing about Spin is you'll get help very quickly in the Propeller forum (you'll likely get help in C too).
  • edited 2013-12-16 17:10
    ChristianGeek,

    Check the Online Tutorials link on the back of the Propeller Activity Board. That learn.parallax.com/PropellerAB page links to the Propeller C Tutorials at learn.parallax.com/propeller-c-tutorials. They were created with and for the Propeller Activity Board. They're quick, easy, and will get you started on all kinds of fun projects with a minimal time investment.

    For comparison, there are Spin equivalents of some of the pages in the Propeller C Simple Circuits section that can be found here: learn.parallax.com/PropellerBOE

    Andy
Sign In or Register to comment.