Shop OBEX P1 Docs P2 Docs Learn Events
Propeller for dummies... — Parallax Forums

Propeller for dummies...

FORDFORD Posts: 221
edited 2006-02-26 17:50 in Propeller 1
I can't say enough how much I am looking forward to getting into SPIN, as long as I can get a grip on it.

I will probably never be able to program a Prop' using assembly, so I won't waste valuable learning time·trying.
For me, to use·a prop', it all depends on SPIN·being simple enough to learn, or I'm staying with a bs2p, which I mostly use for serial and 1wire stuff.

Having just had a quick look at the serial documents put here by Chip, it is just making it confusing because I haven't seen the SPIN editor, and have nothing which says in basic terms what the heck it all means. Is this forum just for those who have had some pre-training with Parallax ?
It seems that the documents being pre-released, require that you have already seen the editor, which nearly all of you on this forum have. If I had my choice in early documentation, it would be some basics of the SPIN editor and a few "hello world" samples. A sample object is nice, but I don't know where it goes, how it relates to anything in the editor etc etc.

I think its great that this early documentation is released, but it all seems to be for the 'bit bangers' who really know there stuff, or is the Prop going to be a bit tough for people like me ( I dont mind, I just dont want to chase this thing that hard,·and end up staying with a bs2p anyway.)

Don't get me wrong, I am not criticising, just confused, I am as keen as hell to get into it, but I just want to start at the first step.
So I guess I have these 3 questions...

1- Will the SPIN language be simple for·people like me to learn, or will I need·to learn·to 'bit bang' a lot better than I can now, to be able to use it ?

2- Is the SPIN editor and documentation done in a simple approach like the newer stamp manuals, with circuit diagrams and very detailed breakdowns / examples·of each command etc ?

3- ...Or should I have just listened at school ?, (my Mum says I only went there to eat my play lunch).
I also have one suggestion...
Forum users indicate that they are talking in SPIN or assembly, so that some·users can·disregard assembly or spin·stuff. Or evan an option button in the forum to select SPIN / Assembly to separate the 2. Not necessary now, but I'd like to see the number of posts in this forum in 3 months time...

Cheers,
Chris,· West Oz.

Comments

  • CHIPKENCHIPKEN Posts: 45
    edited 2006-02-26 02:34
    You need to keep looking at the spin talk. Soon it will turn to SPIN BASIC (or sbasic) to meet the needs of the others I am sure. Too, I am sure you will see a BASIC Stamp with a Propeller chip on it in the near future. Think of all the new basic commands we can now have. Why don't you and others suggest commands you would like to see.

    Chuck
  • OzStampOzStamp Posts: 377
    edited 2006-02-26 03:18
    Hi Chuck
    We started that list 4-5 day's ago ( LOPO list see the topic)
    Not many people have added as yet...

    Ron
  • FORDFORD Posts: 221
    edited 2006-02-26 03:29
    Thanks Chuck, appreciated,
    That is perhaps the best answer I could have received.

    If I·had permission to only ask one question, it would be...
    Approximately how long after the prop release would we start seeing some type of sbasic, and then when·in a stamp format. (Sorry, thats 2 questions.)

    With regards to some of the commands we would like to see, I guess that needs more thought / understanding of what is different about using sbasic with the memory structure of the prop.

    Perhaps some of the pbasic commands would now·be necessary in sbasic,·then we may not need things like the ** modifier etc.

    If the features I have seen in the stuff released so far were possible in sbasic, I could·use it in our products so much faster, and at a much lower time / $ cost.


    Regards,
    Chris,
    West Oz.
    ·
  • FORDFORD Posts: 221
    edited 2006-02-26 03:33
    Sorry I meant to say...

    Perhaps some of the pbasic commands would now·NOT be necessary in sbasic,·then we may not need things like the ** modifier
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-02-26 03:36
    Don't get too hung up on Spin. Of those docs Chip posted, all the regular user would have to understand would be 1st, short one in the message itself. It has variables, loops, conditionals very similar to PBASIC. The only addition is being able to create an instance of an object (called com in Chip's description to perform serial comms for the user) then be able to call/pass data to routines in that object (com.tx I think was an example).

    It's like having a calculator object called calc.

    x:=calc.add(2,5) to add 2 and 5 and store in x
    or
    x:=calc.mult(2,5) to multiple 2 and 5 and store in x.

    Ok, silly example, but you get the idea.
    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel

    Disclaimer: ANY Propeller statements made by me are subject to my inaccurate understanding of my limited time with it!
    Southern Illinois University Carbondale -Electronic Systems Technologies
    Personal Links with plenty of BASIC Stamp info
    and SelmaWare Solutions - StampPlot - Graphical Data Acquisition and Control
  • FORDFORD Posts: 221
    edited 2006-02-26 03:54
    Martin,
    Not so silly, and appreciated,
    Thats the learning curve I want to start with, and I can understand that·if its put before me in the right order.
    I have no doubt that the official documentation will be like that.

    The sbasix stuff sounds good to me though, especially if it ends up·in a similar editor environment where you can view memory maps in each cog etc,·and be basically just adding more commands to what we are already used to using. Because we already have a lot of equipment out there, running well on bs2p's (which have the whole 8 slots full), it will be nice if I can sort of step across into the propeller, not have to step back a bit, and then catch up to where we already are. (knowing that the prop is going to be far superior).

    This begs the question...
    If you could do all of the same things with an sbasic type editor. Why would anyone bother doing it in assembly ?
    There must be some system performance loss somewhere, or we would just do sbasic instead of bitbanging.

    By the way, I made the mistake of·browsing the info in the 'Guts' document about 'Log Tables'... Well, maybe in another life.

    Cheers,
    Chris
  • Beau SchwabeBeau Schwabe Posts: 6,545
    edited 2006-02-26 04:24
    Perhaps it might be easier to refer to the code that Chip posted.


    OBJ

    Com : "FullDuplexSerial"

    PUB Go

    Com.start(31, 30, %0000, 115_200)

    (snip)


    OBJ and PUB are block headers that the Propeller Tool uses to define certain areas of code the location is not critical.

    The line that reads...

    Com : "FullDuplexSerial"

    ...is a way of assigning an alias to "Com". It represents a file with the name "FullDuplexSerial.spin". Sort of like an INCLUDE statement.


    PUB is sort of like defining or setting up a subroutine (i.e. GOSUB/GOTO)

    The line that reads...

    Com.start(31, 30, %0000, 115_200)

    ...Is actually calling a subroutine within "FullDuplexSerial.spin" named start, and passing arguments to it.


    Note:
    A call can either be other objects, or other aliased objects.
    An initial object is necessary to launch an assembly object.
    An assembly object must have it's own cog.
    Arguments can be passed by reference to and from an assembly object and Spin object to any other object.


    One of the great things about the Propeller environment, is that you have the flexibility to create your own
    unique special function objects. Say for instance you create a "function" or "command" that does exactly
    what no other command is capable of. If you want to you can call it "Fred.spin". To use that function in
    ANY Propeller program, you reference it like this....

    OBJ

    MySpecialCode : "Fred"


    ....Now suppose you have one PUB routine inside of "Fred.spin" that is calls "FeedTheCats", and another that
    says "WaterThePlants". From any other program with an OBJ reference such as above, you could call it like this...


    PUB MainLoop

    MySpecialCode.FeedTheCats
    MySpecialCode.WaterThePlants


    ...Obviously you don't want to water the plants every time you feed the cats, but hopefully you get the idea. If not
    it will make sense. After all there is no support in this forum or from Parallax (<- Just kidding) smilewinkgrin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • danieldaniel Posts: 231
    edited 2006-02-26 04:54
    several people said...

    sbasic

    We might want to be a bit careful of the term SBasic.· It is already an established robotics·product·from Karl Lunt (http://www.seanet.com/~karllunt/sbasic.htm) and·has broad exposure via Nuts & Volts, Lunt's book Build your Own Robot!, and the Seattle Robotics Society, among other venues.

    Daniel
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-02-26 05:06
    I don't think you'll ever see a Spin BASIC per se anytime soon. It would require a totally new tokenizer, which the Parallax staff are too busy lauching this one to deal with, and Spin has been developed specifically with the needs of this processor in mind. What you hopefully will see from other users, such as myself, is PBASIC functionality to be used in Spin. For example, I'm working on an a library to try and duplicate some PBASIC instructions to help lesson the user curve, so others can do things like:

    BS2.PULSOUT(1,100)
    or
    BS2.PULSIN(5,1)
    or
    BS2.FREQOUT(8,100,500)

    This would be used in Spin such as (not really code testing, so grain of salt please):

    VAR
    · LONG X

    OBJ
    · BS2: "PBASIC_LIB"······ ' Post updated and corrected

    PUB Main
    · REPEAT ' Repeat all forever - DO
    ···· REPEAT X FROM 500 TO 4000·············· ' like for x = 500 to 4000
    ······ BS2.FREQOUT(5,100,X)
    ······ BS2.PAUSE(100)

    Note: Indents define code blocks instead of using NEXT's, LOOPs and such.

    Just remember, each cog could be running a different program, allowing you to continually PULSOUT on 1, while sounding tones or checking sensors on others.

    -Martin

    Post Edited (Martin Hebel) : 2/26/2006 6:54:11 PM GMT
  • PLJackPLJack Posts: 398
    edited 2006-02-26 17:31
    Thanks for posting that Martin.
    I was going to mention something similar as I was reading this post, but you did a much better job at describing it.

    So here is my question regarding:

    OBJ
    BS2: "PBASIC_LIB"

    I equate that to an "Include" statement.
    Is that a pre-compiler directive. In other words, if I include PBASIC_LIB does the entire PBASIC_LIB get placed on the PChip or just the routines that the compiler finds within the source code?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - PLJack - - -



    Perfection in design is not achieved when there is nothing left to add.
    It is achieved when there is nothing left to take away.
  • Martin HebelMartin Hebel Posts: 1,239
    edited 2006-02-26 17:50
    Yup, it pretty much acts as an #include, but with a twist that it creates an Object named BS2 of the "class" file PBASIC_LIB. Kinda of mixing languages and terminology, but I think you get the point.

    My guess is it uses the full file, and not just the referenced routines (methods/functions) code. I'm away from my workstation right now, or I would try it and check the memory allocation. Maybe someone else has an answer?

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Martin Hebel

    Disclaimer: ANY Propeller statements made by me are subject to my inaccurate understanding of my limited time with it!
    Southern Illinois University Carbondale -Electronic Systems Technologies
    Personal Links with plenty of BASIC Stamp info
    and SelmaWare Solutions - StampPlot - Graphical Data Acquisition and Control
Sign In or Register to comment.