Shop OBEX P1 Docs P2 Docs Learn Events
moving over from Stamp programming to the Propeller world — Parallax Forums

moving over from Stamp programming to the Propeller world

Steve2381Steve2381 Posts: 94
edited 2009-12-13 13:55 in Propeller 1
Hello.

I am moving over from Stamp programming to the Propeller world. Any pointers as to its abilities and skills would be greatly received!
I understand it has audio and video capabilities. What does it actually allow you to do?
Finally... is the programming a far leap from Stamps?

Many thanks!.... looking forward to hours of programming

Steve

Post Edited By Moderator (Bean (Hitt Consulting)) : 12/12/2009 10:55:00 PM GMT

Comments

  • localrogerlocalroger Posts: 3,452
    edited 2009-12-12 22:51
    Steve, if you can program stamps you can program propellers; much of the hard work has been done by people who write standard objects posted in the object exchange. The best advice is to get one and try to make it do something -- probably how you got started in stamps. It's possible to make a Prop do useful things with little knowledge at all once you learn the basic Spin stuff and how to use the objects. And over time you'll hunger for more, and you'll get into more advanced techniques, writing more complex Spin code and PASM. Jump in, the water's fine -- and shallow in places if you want to go slowly.
  • StefanL38StefanL38 Posts: 2,292
    edited 2009-12-12 23:42
    Hello Steve,

    so the main difference between PBasic and spin is that pbasic has more sophisticated commands
    than you have in SPIN.
    PBasic example

      SERIN RX\RTS, Baud, 100, No_Data, [noparse][[/noparse] ioByte ] 
    
    



    in PBASIC the serin-command is hardcoded and you can't change its behaviour.
    The only variance is to call the command with different values for the parameters.

    In SPIN the "high-sophisticated" commands are realized through the combination of
    basic commands

    example receive a serial byte is done by the code

    PUB Rx : rxbyte
      '' Receives byte (may wait for byte)
      '' rxbyte returns $00..$FF
    
      repeat while (rxbyte := rxcheck) < 0
    
    



    "PUB" indicates a subroutine (similar to a label in PBasic

    "Rx" is the name of the subroutine

    repeat while are elementary SPIN-commands

    the command "rxcheck" inside the subroutine "Rx" is another subroutine
    defined or "build" with elementary SPIN-commands

    PUB RxCheck : rxbyte
    
      '' Check if byte received (never waits)
      '' rxbyte returns -1 if no byte received, $00..$FF if byte
    
      rxbyte--
      if rx_tail <> rx_head
        rxbyte := rx_buffer[noparse][[/noparse]rx_tail]
        rx_tail := (rx_tail + 1) & BUFFER_MASK
    
    



    now the command "if" used in "RxCheck" is a REAL elementary SPIN-command

    all the rest are variables that are nescessary to make it work but the variables are not important for the user

    This means: in SPIN more complex commands are not "hardwired" like in PBasic
    they are build out of elementary commands by defining sub-routines

    Objects in SPIN are simply SPIN-files containing a collection of subroutines all build with the elementary set of SPIN-commands
    which provide complex commands. In the code-example above a command to receive a byte over a serial connection

    Now you may ask where are the parameters like IO-pins and baudrate ?
    the parameters IO-pins and baudrate have to be configured ONE time.

    The propeller-chip has 8 processor cores. These cores are called "COGs"
    All the bitbanging for send and receive serial data is done by a second COG which works as a "driver" in the background
    This cog has to be started before you can do serial communication.
    This means a part of the code inside the file FullDuplexSerialPlus.spin is executed in the second COG running ALL THE TIME
    waiting for serial data to be received and transmitted. This part of the code runs parallel to the first COG.

    You can imagine this driver as if you would have a butler listening for the doorbell and as soon as he hears the doorbell
    going to the door open it and take in the presents that are delivered. And listening for orders to bring some documents
    to Mister A, oder Mister B

    There is an object for serial communication, for creating a TV-signal, VGA-Signal etc., etc., etc.

    If you want to use these complex commands you define a "connection" between the filename and an object-name

    OBJ
      Debug   : "FullDuplexSerialPlus"    'short name FDX+
    '   &#9474;            &#9474;
    '   &#9474;            &#9492;this is the filename WITHOUT extension ".spin"
    '   &#9474;
    '   &#9492;this is the objectname 
    
    



    after defining this name "Debug" you can access the omplex SPIN-commands wich are defined in the file FullDuplexSerialPlus.spin

    by writing ObjectName.Methodname

    in the example above to receive a byte

      MyByte := Debug.Rx 
    
    



    best regards

    Stefan
  • Steve2381Steve2381 Posts: 94
    edited 2009-12-13 00:02
    Thanks for the replies. Looks like the best plan is to get a starter kit and dive in. Stamps are fine, but too slow and expensive.
    I will have a look for a decent starter kit and loose my evenings for the rest of winter!
    Thanks
    Steve
  • Tony B.Tony B. Posts: 356
    edited 2009-12-13 13:55
    As a beginner I would recommend under the Propeller Tool help menu,

    1. The Propeller Education Kit Manual
    2. Propeller Help…. Which is the old tutorial that was in the Propeller Manual 1.0. (The new version 1.1 doesn't have it)

    As a beginner I have found them to be a great help and introduction to programming the Propeller chip.
Sign In or Register to comment.