How hard is it to learn Spin vs Parallax Basic or SX/B?
Roy Carlson
Posts: 46
I am wondering how hard it would be to learn SPIN and move from basic stamps and/or Pic chips over to the Prop Chip?
I was pretty successful getting through and understanding the Basic Stamp series of books and programming sensors, LCDs, etc.· I tried to switch to the PIC chip but find the environment and cost for the full programmer too high and confussing.· I did start to learn and go through the SX chip modules but now I hear they are being discontinued.
What are you thoughts on programming the Prop Chip and how easy is it to move over to Spin or some other basic type language?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
I was pretty successful getting through and understanding the Basic Stamp series of books and programming sensors, LCDs, etc.· I tried to switch to the PIC chip but find the environment and cost for the full programmer too high and confussing.· I did start to learn and go through the SX chip modules but now I hear they are being discontinued.
What are you thoughts on programming the Prop Chip and how easy is it to move over to Spin or some other basic type language?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Comments
The PE kit is really good. Even if you don't get the PE kit, use the manual for it, it is a great tutorial.
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
-Phil
Your "irritation" doesn't come from Spin syntax; it is, rather, a direct result of your prior exposure to C!
-Phil
From my short experience (I got started with the prop at UPEW), my recommendation would be to start with a demo board if that's affordable for you. Having some basic interface circuits ready-to-go makes it really easy to load some demo code and dig through it to learn. I did this with a lot of the VGA and TV output objects from OBEX and I have been able to learn a lot about how SPIN works and should be structured. Plus, getting to see the effect of code changes on the screen is a little encouraging.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Andrew Williams
WBA Consulting
WBA-TH1M Sensirion SHT11 Module
When you went to work on the pic, I think you might have experienced the difference between parallax and other companies when it comes to support and education. Parallax is top notch in this respect, and the propeller is top notch among microcontrollers.
When you learn spin, there is something you don't have to learn, which is interrupts! Blast those nasty things cause so much trouble! I was just reading about interrupts in the current issue of Circuit Cellar. I am so glad I don't have to deal with those headaches. Of course, I don't HAVE TO do spin either, as this is more for fun for me.
And FUN it is.....and so is this forum, BTW. You will find lots of helpful people here.
And while I am at it, do get the PE Kit like Rich said, but don't get the USB version. You will miss the sticker that goes on the prop, and if you fry your propstickUSB, it isn't just $8 to replace it. The book is quite a good, and there are more labs beyond that posted at the top of the propeller forum page.
Just my 10 bits worth,
Doug
The Help and Support from Parallax is truly only a small fraction of the true picture which is the help and advice and encouragement one gets from this forum.· I am truly greatful to all and will start selling all my PIC/PicAxe parts on eBay and focus on SX/B and the Prop.
If anyone has a PE Kit they are willing to sell, with manual, please let me know as I am in the market.
Thanks again,
Roy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
Later, you can progress to PASM (assembler). It is quite easy because of the regular RISC instruction set.
There are lots of things that you can add. Start with a couple of LEDs to flash. Then VGA and/or TV (composite video) plus PS2 keyboard and mouse are easy to use as there are objects for them already to run. Nothing like seeing the output of a program in color on a screen. You can even run the CPM Z80 emulation (ZiCog) using an SD/microSD card if you are into old things.
So much to do, so little time
P.S. The hardest thing is to find the documentation - ask here if you want something as the search engine is not so good. We all have our own little links to help you on your way.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Using SPIN on a day to day basis, it's not a difficult language to work with. Certainly no more difficult than transitioning between C and Pascal (with a bit of Python thrown in).
I honestly think in the time someone takes in whining about the lack of BASIC for the Propeller, they could learn enough SPIN to get kicked off on the road to programming enlightenment (bit that's just me). The most important part is to read the manual (really!). There are some operators that are somewhat counterintuitive ( >= <= for example), but where extreme performance is unimportant, SPIN is incredibly efficient and compact (read that as 3-4 times smaller than C).
BASIC - If you always do what you always did, you always get what you always got.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lt's not particularly silly, is it?
The GOTO is seen as "bad" or "poor form" programming wise. I think I get that, but when I transition to assembly language, it makes perfect sense where I would use a GOTO, I would code a JMP, so what gives?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Safety Tip: Life is as good as YOU think it is!
Here is the manual.
Didn't realize that they were out of stock. If you already have a breadboard you could get the Propeller DIP Plus Kit and Prop Plug - all the PE kit documentation is available online. That would get you started. Depending on what parts you have on hand you might want to also get the PE Kit Project Parts. Those three things together include all that the PE Kit has (I think) except for the nice Plano box and the breadboard.
I have two PE Kits that are on larger breadboards with six LEDs and three buttons. I might be willing to part with one of them but you would still need to get a Prop Plug and you would probably want the PE Kit Project Parts as well. You would miss out on the fun of building the circuit yourself though.
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
maybe the problem with the GOTO in BASIC is the assumption of lack of experience when dealing with BASIC, but when you are doing assembly, you must be an expert
Spin's control flow statements are rich enough that GOTOs (and labels) are very very rarely needed and, even then, QUIT / NEXT / ABORT are usually enough. If someone wants to extend Spin to include labels and GOTOs, the interpretive operations do exist. There has to be some extra compiler complexity to figure out and flush extra stack contents, but that's straightforward.
Hopefully, by the time a person "graduates" to Propeller assembly, he will be imprinted enough by Spin's enforced structural concepts that it will carry over, despite having to use jmps. You can write beautifully-structured code with the likes of GOTO and jmp, but you also have the freedom to create a spaghetti-coded mess. It's this latter freedom that language designers strive to keep from the hands of beginners, lest they develop bad coding habits.
-Phil
Part of this comes from the fact that things I take for granted in PBasic, like SERIN/SEROUT, are NOT simple one-line statements in SPIN. They CAN be in a given program, but that is dependent on declaring as an object an entire other program (FullDuplexSerial, HalfDuplexSerial, SimpleSerial, or whatever works for your app) to do the work for you. The Basic Stamp already has that kind program functioning in some manner in the interpreter chip, so it knows what to do with the parameters you pass to it.
For me, I have a personal problem with needing to know what every line, every symbol and every operator does in a program before I feel comfortable using it, so happily using SERIN/SEROUT is, for me, OK, because the chip contains the meat of it and I'm OK with that, but the Serial Object that has to be called in SPIN means that I have to understand what's happening in there, and it's currently over my head despite the extensive commenting. Only when I understand it enough to know what parts of it I can cut out with impunity or change to suit the needs of my particular application, or even better, to write my own custom version to do the same thing, but "my way", can I feel I can say that I will "know SPIN".
So if you're not as messed up as I am with needing to know everything before you can use it, SPIN may be only a little more difficult than PBasic. For me, it's a quantum level more difficult!
Dave
Using the FullDuplexSerial object is easy as. You do not need to understand the object code just because you can see it. What do you think Serin/serout does? It does the same thing except it is hidden from you. You don't go and find that code and look at it.
I don't actually know the Serin/Serout syntax, but it has to be something like...
SEROUT("A") --> fdx.tx("A")
b = SERIN --> b := fdx.rx
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
It's just me... and a few other hacker-types I know. But when all is said and done, it results in our having a very deep understanding of what's going on - possibly one that differs from other's definitions, but one that proves immensely functional when it comes to making things do stuff that others have not thought to try.
My way of thinking probably doesn't work for 80% of people, but for the 20% of people out there who do think that way, the above is an accurate description of what they'll find with SPIN.
SERIN/SEROUT in PBasic, since you mentioned it:
SEROUT TX, Baud, [noparse][[/noparse]"!NB0R33"] ' Send Command To Read Variable 33 on PINK Server
SERIN RX, Baud, 100, Timeout, [noparse][[/noparse]dflag] ' Get data changed variable value (Baud is a VAR set earlier, Timeout is a goto routine, dflag is a data var)
About as simple as you can possibly get. No doubt everything that these commands do here is the same as in the Serial objects in SPIN - just that these rely on the preburned firmware in the PIC16F57 PBasic Interpreter chip. Nothing for me to crawl into and disect!
Dave the obsessed...
Enjoy!
Thanks again to all for the input and I look forward to asking you more questions once I get my shipment from Parallax.
I do have some accessory parts and chips if anyone is interested in swapping for a 40 pin prop?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·
I think that works for me. I found it difficult to deal with Assembly the first time out, having the goto hammered out of me early on. (pascal)
So then, got into 8 bit assembly language and the bad habit avoidance worked ok. (I still do goofy stuff...) Was able to structure things, but on 8 bitters, stuff needs to happen, so it ended up being somewhat crude and spaghetti like. (no 16 bit relative addressing on 6502 @#^$%@#*$%!)
Work in assembly for a while, come back to structured languages and kind of just want to build my own loops again, and look right for the GOTO... Arrgh!
It's an endless cycle I experience right up through SPIN, where it is so closely aligned with PASM, it seems silly to not have a JMP, right in the language.
Of course, I agree that would have produced a ton of fairly bad code, but then again, it would have been kind of cool too, when going back and forth. PASM is just elegant. It's a straight forward translation back in SPIN land. I'm glad the choices were made the way they were however.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Propeller Wiki: Share the coolness!
Chat in real time with other Propellerheads on IRC #propeller @ freenode.net
Safety Tip: Life is as good as YOU think it is!
Post Edited (potatohead) : 9/8/2009 7:08:36 AM GMT
Now that I have used it for as long as I have, it is a fantastic language (though it is a bit shallow as a high-level language -- it is only a micro controller), albeit painfully slow at times. Once you reach the point where SPIN can't cut it for speed, PASM isn't that big of a jump. The 32-bit assembly language is mind-altering coming from only high-level languages. But was a fairly fast transition. Applications that execute at 50 or 100 times faster than their SPIN counterpart is also very nice.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
So, the GOTO had some fairly strict limitations. The overhead (complexity) of GOTO in spin would be significant.
In PASM you can always use CALL instead of JMP as long as you remember that the subroutine is NOT re-entrant (i.e. the subroutine may not be called while it is indeed being called). This is because the return address is held in a fixed location, not on a stack. Anyway, Assembler and High Level languages cannot be compared against each other. They are for two very different purposes. In most cases, it is reasonable to say that ASM is reserved for when you cannot do it in a high level language - e.g. speed, space, functionality.
FWIW: My speciality and preference is ASM. I like Basic (MSBasic, etc & VB6, not VB.Net), (Turbo) Pascal. I don't like C (interesting since I like Asm). Basic has evolved to include some of the better elements of Pascal and other languages. In my opinion, Spin is a mix of C and Basic. It mandates structured (indented) code which is excellent - but if not followed properly can cause problems/bugs but forces the structure which is a good thing for learners. IMHO those that do not like this do so because they have developed bad habits. (Sorry guys, but I used to teach programming in the 70's & 80's. It's just like backups... if you do not do it, then it's a bad habit and ultimately will bite you!) However, I do not like the C style syntax elements in Spin of !, ~, ~~, etc because it loses readability. Now we have 2 independent compilers, maybe some of the syntax could be extended to make it more readable.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
I personally view this as a side benefit to learning Spin.· I also enjoy working with modern Basic compilers, they have come a long way since their beginnings and many structured versions are quite capable.
Ultimately, however, we are dealing with a microcontroller and not a microprocessor (though the lines may be blurred in some instances).· Many times we need to code with the project's hardware operation in mind, and that is when it becomes more helpful to begin thinking of the chip in native machine operation terms, especially when attempting to handle manipulation that needs to be custom coded rather than downloaded from an object library.
So imo Spin is a great transitional language that provides the bridge from high-level languages such as Basic to more machine oriented languages such as C and assembly.· You begin to get a better feeling for what is going on (especially bitwise operations), while retaining ease of use.
> ·the whole multi-cog thing was a difficult concept to wrap my head around and use properly.
I had similar troubles, but I think I'm getting there ;-)·· Really this is more a result of hardware architecture than language; while Spin obviously provides methods of handling the multiple processors, the comphrension of how and why to code are related to dealing with the hardware and not the language.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (Agent420) : 9/9/2009 12:09:09 PM GMT
Spin is as close to a natural language as I have seen. But it is also a very powerful language... So, for weak programmers, Spin is very approachable and for strong programmers it is wonderful. The documentation speaks to a variety of audiences. If you find something you don't understand... well... probably that documentation was developed for and directed at a more expert audience. There is a lot of that around. The Lab sessions can take a person with no electronics or computer background and get them going very smoothly.
Lab sessions--->Spin-->OBEX + sensors-->PASM
Go with the Prop... you will never look back.
Rich
Rich H
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Servo Boss, a 12 channel servo tester kit from Gadget Gangster.
... works for me ;-)
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔