Shop OBEX P1 Docs P2 Docs Learn Events
Need help in using SPIN language and libraries — Parallax Forums

Need help in using SPIN language and libraries

Ashar748iAshar748i Posts: 1
edited 2011-06-15 00:41 in Propeller 1
Hello,
Im new in using SPIN, I am working on a project using Propeller but dont have the time to thoroughly learn the SPIN language. So I was wondering if any one can give me any information on how to get a quick hold of the SPIN language and how to use the various libraries.
Thank you.
Ashar748i

Comments

  • Kirk FraserKirk Fraser Posts: 364
    edited 2011-06-13 23:09
    My suggestion is to just load some examples from the library and compile them to see what they do, making minor mods to get the LED you have on a pin to flash, etc.. Then target the statements you need and find how they work, reading the statement syntax in Propeller Tool / Help / Quick Reference. For the libraries, first look in the / Propeller manual for debug until you find a screen shot and text showing how to communicate with your serial terminal. Once you have interaction with your Prop, you should be able to guess which statements will get you closer to your goal, try them out, and study them if they don't result in expected response in the serial terminal. After you hack your way through that for a while, you should be ready for actual redesign of your program to do it right.
  • Cluso99Cluso99 Posts: 18,069
    edited 2011-06-13 23:36
    Ashar748i: Welcome to the prop forum. As Kirk suggested, and presuming you are familiar with programming languages, a good summary is on the Quick Reference chart that is downloaded with the proptool. Then perhaps look at some code from the OBEX (Object exchange) that does something like what you want. There are a couple of short examples also downloaded with the proptool that may help.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-06-14 00:10
    Ashar748i, Welcome. It would probably help if you described your project (the more detail the better) so we could point in the direction of objects that would be most useful to you.

    Getting multiple cogs to work together can be a trick when you're first learning how to use the Propeller. I regret not asking more questions when I was first learning to program the Propeller.

    When you post code, use the Propeller Tool's archive feature. File | Archive | Project...

    You can also post small sections of code within the text of your post. To display code use the code tags: [ CODE] your code here [ /CODE]

    Code entered with the tags will look like:
    if eepromIndex == 0
        eepromIndex := _EepromBegin
        Eeprom.FromRam(@eepromIndex, @eepromIndex + 3, @eepromIndex)
        eepromFlag := 0
    

    Which is much easier to read than:

    if eepromIndex == 0
    eepromIndex := _EepromBegin
    Eeprom.FromRam(@eepromIndex, @eepromIndex + 3, @eepromIndex)
    eepromFlag := 0


    I had to add a space to the tags to make them visible. Leave the spaces out when you use the code tags.

    Without using code tags the indentation is lost. As you probably already know, indentation with Spin is very important.

    I think, and most on this forum will agree, the Propeller is an amazing microcontroller. It's really the best uC for hobbyists (IMO). The Prop's ability to run multiple processes at once makes writing code both easy and fun.

    Duane
  • markaericmarkaeric Posts: 282
    edited 2011-06-15 00:41
    Ashar748i,

    I highly recommend reading the Fundamentals book from the Propeller Education Kit thread:

    http://forums.parallax.com/showthread.php?89958-Propeller-Education-Kit-Labs-Tools-and-Applications
Sign In or Register to comment.