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

Spin or PropBasic

VonSzarvasVonSzarvas Posts: 3,522
edited 2010-03-11 11:01 in Propeller 1
Hi Proppers !

I completed a project work with SX/B some time ago, and really enjoyed the Parallax experience! Now I am happy to have been "assigned" a new project, and I am seriously thinking about the Propeller.

I have already purchased the Customizing book (very nice), and also the usb proto board, propplug, etc. So I am set to experiment and learn!

The first chapters of the book lead me to a big question though! Language choice ! .... As I am starting from scratch, which to choose!

From what I have read I would start by saying that I feel fine about learning/using Spin (it seems really logical to me).

However, it seems (to me) that Spin is interpreted by the Propeller, whereas PropBasic is compiled to PASM - which would then not need interpreting nor reserved stack workspace/longs. And therefore PropBasic will execute faster (much "faster"?) than the same program in Spin. And also (perhaps) require less ram - so I could fit in a program with more commands using PropBasic than I could with Spin ?

I also like the idea (as with SX/B) that I can see the created PASM, and therefore have the chance to further "tweak" - should I be so bold.

So I think I already sold myself onto starting with PropBasic... idea.gif

Does this seem like a reasonable decision ? If not, why should I choose Spin instead of PropBasic ? What am I missing ??

Thank you!

Max.


Comments

  • Rob7Rob7 Posts: 275
    edited 2010-03-10 20:27
    Hi Max,
    I looks to me that you have made up your mind.
    I first started to work with the propeller in spin.
    Basic is easy to use and converting from Basic using the BS2 to PropBasic with the Propeller was an easy transition, the chance to learn PASM was also a great benefit.


    Rob
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2010-03-10 20:39
    Both are positive starting places for working with the Propeller!

    Had Propeller BASIC been around back when I started in '07 I'm pretty sure I'd still be playing with it.
    Having starting in Spin, I can tell you that it is rewarding and not nearly as daunting as it looks! [noparse]:)[/noparse]

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Coming soon to a browser near you! PropellerPowered.com
    Visit the: PROPELLERPOWERED SIG forum kindly hosted by Savage Circuits.
  • VonSzarvasVonSzarvas Posts: 3,522
    edited 2010-03-10 21:28
    It's the part about a program written in Spin being slower to execute than the same program written in PropBasic which is my concern about Spin.

    Maybe that is myth ?


    Otherwise, I would like to choose Spin - it seems a really well constructed, brief and logical language (well done the author!), and the Obex is full of great starter blocks !

    ...Mind - The Obex also has P/ASM objects which can be dropped into PropBasic (as I understand it). confused.gif
  • jazzedjazzed Posts: 11,803
    edited 2010-03-10 21:34
    Perhaps Spin images are also smaller than PropBasic images ?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Short answers? Not available at this time since I think you deserve more information than you requested.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-03-10 21:38
    Jazzed

    How about "Insufficient information received to formulate an adiquate reply" as an opposite tag ??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • jazzedjazzed Posts: 11,803
    edited 2010-03-10 21:55
    Some questions are as good as good answers. I've always wondered what your sig meant. Null Pointer?
    Not sure what this has to do with Spin and PropBasic comparisons though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Short answers? Not available at this time since I think you deserve more information than you requested.

    Post Edited (jazzed) : 3/10/2010 10:03:48 PM GMT
  • VonSzarvasVonSzarvas Posts: 3,522
    edited 2010-03-10 22:05
    jazzed: If you mean that the compiled spin bytecode image might be smaller than its counterpart in PASM (which I understand PropBasic compiles to), then does that imply I can get more single commands into a Spin program than a PropBasic compiled to PASM program?
  • jazzedjazzed Posts: 11,803
    edited 2010-03-10 22:16
    Maxwin said...
    jazzed: If you mean that the compiled spin bytecode image might be smaller than its counterpart in PASM (which I understand PropBasic compiles to), then does that imply I can get more single commands into a Spin program than a PropBasic compiled to PASM program?
    Probably.
    Bean or one of his testers might be able to present some relevant comparisons.
    Spin byte code is typically smaller than PASM-like language output though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Short answers? Not available at this time since I think you deserve more information than you requested.
  • BeanBean Posts: 8,129
    edited 2010-03-10 22:18
    PropBASIC is much faster than spin. But depending on your needs spin may be fast enough.

    The OBEX is one big benefit of using spin. But PropBASIC is easier to get started with (in my opinion).

    PropBASIC has alot of commands "built-in" that would require objects in spin (serial, SPI, I2C, etc).

    It really does depend on your needs. Since spin is the "official" language, I think you should at least of an understanding of it. Spin is not that hard once you use it a little bit.

    As for code size, I'm not sure about that. It's probably pretty close to even. If you put often used PropBASIC commands in a subroutine, PropBASIC is pretty tight code.

    PropBASIC does have the 496 instruction limit, but that is per task. And you can use LMM if you run into that limitation. LMM runs about 5 times slower, but is still way faster than spin.

    I'd say try out both and see which one meets your needs.

    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • jazzedjazzed Posts: 11,803
    edited 2010-03-10 22:34
    Nice summary Bean. I guess most Basic users (a dominant force for Parallax) would likely be using the built-in tools.
    I used SX/B for a while for some small projects. It was a nice program. The SX debugger was also a helpful tool.

    The only part about Spin that's not *free* is the investment in learning another language for newer programmers.
    Do you have a method for using all the chip's resources today? That is can you write a 32KB PropBasic program like in Spin?

    When will you include LMM as part of the PropBasic run-time?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Short answers? Not available at this time since I think you deserve more information than you requested.
  • BeanBean Posts: 8,129
    edited 2010-03-10 22:54
    Jazzed,
    LMM is already part of PropBASIC. So yes you CAN make a 32K propBasic program.

    To use LMM you just add LMM to the PROGRAM line. Like: PROGRAM Start LMM

    Each task can be either native code or LMM too. Just add LMM to the TASK line. Like: TASK MyTask LMM

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • jazzedjazzed Posts: 11,803
    edited 2010-03-10 23:00
    Nice to hear you have that working Bean. Some size comparisons with a substantial program would be useful.
    --Cheers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Short answers? Not available at this time since I think you deserve more information than you requested.
  • HumanoidoHumanoido Posts: 5,770
    edited 2010-03-10 23:17
    Bean said...
    PropBASIC does have the 496 instruction limit, but that is per task. And you can use LMM if you run into that limitation. LMM is already part of PropBASIC. So yes you CAN make a 32K propBasic program.
    Bean: how many instructions total (average) will fit into the 32K program?

    humanoido
  • BeanBean Posts: 8,129
    edited 2010-03-10 23:31
    humanoido said...
    Bean: how many instructions total (average) will fit into the 32K program?

    humanoido
    Oh, that is really hard to say. Some commands generate only 1 PASM instruction. Some commands generate dozens of instructions.

    All VARs are still in COG memory so they are limited to 496. But that's a lot of variables.
    Of course HUB vars and DATA are still in HUB memory as always.

    LMM is kind of an undocumented feature. We needed to draw the line so the documentation could be finished without a moving target. But it does work with everything I've thrown at it.

    Bean


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.

    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    ·
  • MagIO2MagIO2 Posts: 2,243
    edited 2010-03-11 07:52
    Can you have small subroutines inside of a LMM COG? Guess that would speed up LMM very much for some programs.
    496 VARs in COG memory seems to be a very theoretical value ;o) Who'd have access to these 496 variables?
    What size do your HUB memory pointers and jump addresses have? Is it possible to exceed the 32k limit?
  • Cats92Cats92 Posts: 149
    edited 2010-03-11 08:24
    Have you exemples to compare Propbasic speed / Spin speed ?
    Is it possible to write IR detection programs , like IRremote , with PropBasic?
  • TonyWaiteTonyWaite Posts: 219
    edited 2010-03-11 11:01
    @Cats92

    JonnyMac has posted SIRCS code on the PropBASIC thread, page 7:

    http://forums.parallax.com/forums/default.aspx?f=25&p=007&m=412552

    Regards,

    T o n y
Sign In or Register to comment.