Shop OBEX P1 Docs P2 Docs Learn Events
New to Spin ... — Parallax Forums

New to Spin ...

RsadeikaRsadeika Posts: 3,837
edited 2013-07-09 08:28 in Propeller 1
from a SimpleIDE perspective. I have been working with SimpleIDE for awhile, using the C part of it, and I thought I would give that a rest and try some Spin, again. Yes, SimpleIDE is PropGCC centric, so when you start up the IDE it is in C mode. And it is project mode oriented, hopefully their will be no debate about the project mode, that debate has already been done.

Below is the code listing for a program that basically sets up a terminal I/O situation with three commands, turn on an LED, turn off an LED, and quit the program. I tried to gear this for a brand new user of the Propeller, and the Spin language. All of the program commands that are associated with tools.spin, are "under the hood", sort of speak. In fact I left the the tools.spin object without any comments, hopefully you will get the manual out, read about some of the specific Spin commands, and then make the appropriate notations in the tools.spin object.

The zip file that is attached, is a zipped project file, when you unzip it, it contains the test1 project; you will have to find and download SimpleIDE-0-9-28 file. After you have installed SimpleIDE, you can go to the test1 folder and double click on the test1 SimpleIDE Application and the program should start up, in the Simple View format. Then go to the Menu bar press Program->Run with Terminal, that should get the program started, in terminal mode. This is geared for the PropellerBOE, but you can use it with an Activity Board also. You can also get more information in the IDE Help menu.

So, again this for a new user that just wants to start up a program that lights up an LED, and look at some code as to how that was all done. I hope this helps out somebody, because I know when I first started using the Propeller I could have used something like this.

Ray

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'' test1.spin
''
'' July 1, 2013
''
'' To be used with SimpleIDE in Spin mode.
'''''''''''''''''''

'' This program is setup to use the PropellerBOE.

'' In SimpleIDE Spin mode you have to have a _clkmode and _xinfreq
'' because the program is using a BAUD rate of 115200.
CON
  _clkmode   = xtal1 + pll16x                           
  _xinfreq   = 5_000_000

'' This program uses the terminal and some common tools, so
'' to use them, label the objects.                                 
OBJ
  term : "FullDuplexSerial"  '' FDS
  misc : "tools"             '' My object that contains some common tools.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
PUB Start
  '' Setup FDS for a 115200 BAUD rate.
  ''         Rx,Tx,Mode,BAUD
  term.Start(31,30,0,115200)
  Main  '' Goto the main PUB.

PUB Main | inSbyte,inAbyte '' Use local variables.
  misc.waitms(1000)  '' Pause the program for one second.
  term.str(string("Press CR to continue",13,10))
'' Wait for a CR.
  repeat
    inSbyte := term.Rx '' Waits for a CR, if no CR is pressed then it repeats.
    if inSbyte == 13   '' If CR
      term.str(string("Menu: o - LED on, f - LED off, q - QUIT",13,10))
    '' then start the main repeat.
    repeat
      term.Tx("#")
      inAbyte := term.Rx
      if inAbyte == "o"  '' Turns on the LED at 26.
        term.Tx(inAbyte)
        misc.high(26)  '' Pin 26 on PropBOE which is an LED.
'' These next two lines do a CRLF, which could be done in its own PUB
'' within this program, or the CRLF PUB could be in the tolls.spin object,
'' and called with a misc.CRLF. This could be a small assignment, create
'' your own Method, a pub, and add it to the tools object. And then place
'' it in the appropriate parts of the program.
        term.Tx(13)  '' CR
        term.Tx(10)  '' LF
      if inAbyte == "f"  '' Turns off the LED at 26.
        term.Tx(inAbyte)
        misc.low(26)
        term.Tx(13)
        term.Tx(10)
      if inAbyte == "q"  '' Quit the program.
        term.Tx(inAbyte)
        term.Tx(13)
        term.Tx(10)
        term.str(string("Program Stopped",13,10))
        abort  '' Stop the program.
      '' This loop continues until you key in 'q' to leave the program. 
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
«1

Comments

  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-03 07:56
    I saved this spot for further explanation about available IDE for the Propeller. First, a disclosure, I am not a professional programer, I am trying to describe this from a hobby and new user standpoint. Basically there is the Propeller Tool, then came along BST, and now SimpleIDE, although the Spin mode is/was a "bolt on" to the PropGCC centric SimpleIDE. My point of view is for some of the potential new users.

    The Propeller Tool, developed by Parallax, what is there not to like? First off, it does not have a built in terminal mode, yes I know, you can get availability to PST, but that turns out to be a hassle after awhile. For one thing the PST terminal is kind of awkward, for me, and the things that I play around with.

    Some other concerns have been, by other people, is that it is strictly a Windows program. That could be a legitimate complaint if all you have available are Linux boxes or Apple stuff.

    Some of the pluses are the IDE has some very nice highlighting features, it also has a nifty indentation feature. There are other things, this is just a quick overview.

    BST, anybody that has been around this forum has definitely seen references made to this IDE. BST is no longer, nor has it been supported, for quite a few years. One of the things that impressed me, with the IDE, when it first came out, was that it had a "project" feature, which I used quite a lot. The other major feature was that it was available for Linux, so it took care of that aspect that the Propeller Tool was lacking. But, since it is now basically dead, I guess that should conclude any further discussion.

    The last one on the scene is SimpleIDE in Spin mode. There has been some discussion that there will be a more Spin centric SimpleIDE somewhere along the line, the details about this are very very scarce, so it is not known as to what it will really be. The major features that it has: project oriented, available for the Windows, Linux, and Apple crowd, and has a built in terminal mode, just to name a few items. It takes a little more work to use the IDE, but in my opinion it is well worth it.

    The above has been a brief overview as to what is available for the Spin language, since the next major improvement, for SimpleIDE, I think is going to be a Spin centric IDE, I am probably going to keep using SimpleIDE.

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-03 07:57
    This spot I saved for some discussion about the test1 project, it is a very terse program with limited capability to do some interactive programming, meaning you run a program and you see some visible results, immediate gratification for some. I left the program very open so you could add stuff, delete stuff, and so forth.

    The things you do not get with Spin, even when using SimpleIDE, is access to LMM,CMM, or XMM modes. For the beginner that is probably not a problem, yet. I guess you might want to read the manual as it concerns COG ram, and HUB ram, you want to get a firm grasp of this.

    In the program, I use some loops, 'repeat' and 'if', so you really want to pay attention to the indentation, since SimpleIDE does not give you a visual on this like the Propeller Tool does. Be very careful with indentation, it could create some major frustration when you develop a larger program.

    Some of the commands that I use that are associated with the tools.spin object, I left not commented, you really should get to know waitcnt, DIRA, OUTA, and others. In the command(s) wait and waitms, there is a fifty three second limitation that I found out about the hard way, any further interest should be discussed in another thread for those of you that are interested.

    This is a very general overview, there are a lot of Spin experts here, so if you need further explanation, just ask the question, and I am sure somebody will have an answer.

    Ray
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-07-03 18:38
    bst is certainly not dead. It works extremely well and I still use it regularly. Homespun is also similar. Both have listing output options, each with their own benefits. It is just that no more work is being done on bst. Catalina C uses Homespun as the compiler. Homespun source has been gratiously released by Michael Park.

    This in no way detracts from the excellent work being done by jazzed (Steve) on SimpleIDE and open compilers etc by others.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-04 01:18
    bst is certainly not dead.
    OK, let me re state, bst is no longer being supported by the author of bst, meaning, no new updates, features, ..., etc, are being added.

    For the new users, the program in the first post, test1.prj/spin can be run on either bst or Propeller Tool. As I mentioned earlier, SimpleIDE has a built in terminal program which the others do not. If you do not want to use the built in terminal, you can also use some other terminal program that you have access too, just make sure that the comm port is released so your personal terminal comm port can gain access to the port. As you can see this can also get complicated if you are not using the built in tool.

    As you probably can tell I like SimpleIDE, but if the "new" Propeller Tool comes out with the features that bst and SimpleIDE have, then I will probably start using that new IDE. Also, you have to keep in mind that one of these days Propeller II will be available, with the new features of that chip, the IDE will have to be able to make use of those features. So, it seems like this IDE business will change in the near future, not sure which IDE will come out on top.

    Now, if you are thinking of which one to use, then you will have to do your own research, and find out which one is the best fit for you. From a new user stand point, the program that I provided is just a quick and dirty way of seeing what the Spin language is all about.

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-04 05:05
    I just noticed that it is not very easy to find the download for SimpleIDE, so here it is - http://code.google.com/p/propside/downloads/list. Not sure why it is not listed somewhere in a very prominent place?

    Ray
  • PublisonPublison Posts: 12,366
    edited 2013-07-04 06:26
    Rsadeika wrote: »
    I just noticed that it is not very easy to find the download for SimpleIDE, so here it is - http://code.google.com/p/propside/downloads/list. Not sure why it is not listed somewhere in a very prominent place?

    Ray

    Another good place is :

    http://learn.parallax.com/propellerc


  • JonnyMacJonnyMac Posts: 9,107
    edited 2013-07-04 09:11
    Not sure why it is not listed somewhere in a very prominent place?

    Because it's still in a very active development cycle. The author, Jazzed, has been working very closely with the Parallax education department (hence the link posted by Publison) to make SimpleIDE as easy as possible for newcomers, and flexible for experienced programmers.
  • Heater.Heater. Posts: 21,230
    edited 2013-07-04 09:34
    Ray,

    Just one little gripe:
    Some other concerns have been, by other people, is that it is strictly a Windows program. That could be a legitimate complaint if all you have available are Linux boxes or Apple stuff.

    The phrase: ".. if all you have available are Linux boxes or Apple..." makes it sound like us poor saps are some how stuck with Linux or Mac. I might have phrased it as:

    "If your operating of choice is Linux or OSX"

    or

    "If you are not stuck using a legacy Microsoft operating system"

    Sounds much more like the situation.
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-07-04 10:11
    Rsadeika wrote: »
    I just noticed that it is not very easy to find the download for SimpleIDE, so here it is - http://code.google.com/p/propside/downloads/list. Not sure why it is not listed somewhere in a very prominent place?

    Isn't it still in BETA? I has been watching but waiting to start using it, as I am not a participant in the development effort. When its really, I have slew of kids that will want to use it. But best to reduce the number of unknows until the dev is complete.
  • PublisonPublison Posts: 12,366
    edited 2013-07-04 11:04
    Isn't it still in BETA? I has been watching but waiting to start using it, as I am not a participant in the development effort. When its really, I have slew of kids that will want to use it. But best to reduce the number of unknows until the dev is complete.

    Yes it is, but there are some good references and tutorials already @learn.parallax.com
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-04 11:53
    I started this thread to give exposure to the Spin mode of SimpleIDE, the Learn.com has an area called Propeller C, which does not cover any Spin examples. Since I have been using the Spin mode of SimpleIDE, and Spin works as expected, I would say that you could be very confident in using Spin mode in SimpleIDE. I am sure that if that were not the case, jazzed would nave jumped in already to clarify things.

    I think that more clarity, from Parallax, is needed as to what direction support is going as it pertains to Spin? Will it be another Propeller Tool, SimpleIDE, Eclipse, or what?

    Ray
  • jazzedjazzed Posts: 11,803
    edited 2013-07-04 12:06
    Rsadeika wrote: »
    I think that more clarity, from Parallax, is needed as to what direction support is going as it pertains to Spin? Will it be another Propeller Tool, SimpleIDE, Eclipse, or what?

    Ken told to me to do the SimpleSPIN (name still TBD) version as soon as possible. Education is still top priority though.
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-07-04 15:51
    jazzed: Steve, is there a SimpleIDE thread where I can ask some questions? Seems it may be ready to replace PropTool/bst/homespun ???
  • jazzedjazzed Posts: 11,803
    edited 2013-07-04 16:38
    Cluso99 wrote: »
    jazzed: Steve, is there a SimpleIDE thread where I can ask some questions? Seems it may be ready to replace PropTool/bst/homespun ???

    SimpleIDE is part of the Parallax Education Propeller C effort. At the moment SimpleIDE is an IDE designed for using BSTC and/or Propeller-GCC. SimpleIDE is also a platform for some great libraries and tutorials written mostly by Andy at Parallax (and a few by me) with micro-controller sized code in mind.

    The next version of SimpleIDE (un-named so far) will be PropellerTool-ish, will use Roy's Spin compiler exclusively, and will be in a much smaller package (any C ability will likely be an add on).

    The Parallax Learn forum is a good place for beginners to ask questions. Experienced programmers should ask questions here or in the Propeller-GCC forum.

    Next week we will be announcing the latest updates that fix some key issues. I recommend waiting for that before downloading another SimpleIDE package (unless someone suggests downloading a specific version).
  • Cluso99Cluso99 Posts: 18,069
    edited 2013-07-04 21:31
    Thanks Steve. I thought I had missed it getting up to speed for spin and pasm. I will wait for it to use Roy's compiler.
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-05 02:35
    Correct me if I am wrong, but it sounds like there will be two programs, one for Spin, and the other for C. Any chance of discussing what the one for Spin will look like? Will it have a projects feature available, and maybe some other nifty things that the Propeller Tool and bst are missing?

    Ray
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-05 05:09
    The first thing that I noticed with SimpleIDE is that if you try to create a new Spin project while in Simple View, it will not work, so just switch over to Project View to create a new Spin Project. How to do this is described in the Help section.

    I am not sure as to how far I will take this, but here is another new users example. In this program I decided to use a very simple example of the cognew command. If anybody has been browsing this forum they have seen, " Yes, but we do not have to deal with interrupts, we have cogs." So, the program below implements a COG in its simplest form, it starts the LED on P27, and keeps flashing and flashing and ...

    The other thing I used here was the Extended_FDSerial.spin object, if I happen to remember how to use 'RxStr(@myStr)' then I will change the menu selection from 'o,f,q' to maybe something like 'onLED', 'offLED', and 'quit'.

    I added a PUB CRLF, some of the more interested new users may want to look into as why it does not work if you were to move the method into the tools.spin object.

    Ray

    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '' test2.spin
    ''
    '' July 3, 2013
    ''
    '' To be used with SimpleIDE in Spin mode.
    '''''''''''''''''''
    
    '' This program is setup to use the PropellerBOE.
    
    '' In SimpleIDE Spin mode you have to have a _clkmode and _xinfreq
    '' because the program is using a BAUD rate of 115200.
    CON
      _clkmode   = xtal1 + pll16x                           
      _xinfreq   = 5_000_000
    
    '' This program uses the terminal and some common tools, so
    '' to use them, label the objects.                                 
    OBJ
    
      term : "Extended_FDSerial"  '' An enhanced version of FullDuplexSerial (FDS)
      misc : "tools"             '' My object that contains some common tools.
    
    VAR
      long oneStack[10]  '' Most of the time 10 would suffice.
    
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    PUB Start
      '' Setup EFDS for a 115200 BAUD rate.
      ''         Rx,Tx,Mode,BAUD
      term.Start(31,30,0,115200)
    
    '' This starts the COG which is associated with the PUB workLED and uses 
    '' oneStack[10].
      cognew(workLED, @oneStack)
    
      Main
    
    PUB Main | inSbyte,inAbyte '' Use local variables.
      misc.waitms(1000)  '' Pause the program for one second.
      term.str(string("Press CR to continue",13,10))
    '' Wait for a CR.
      repeat
        inSbyte := term.Rx '' Waits for a CR, if no CR is pressed then it repeats.
        if inSbyte == 13   '' If CR
          term.str(string("Menu: o - LED on, f - LED off, q - QUIT",13,10))
        '' then start the main repeat.
        repeat
          term.Tx("#")
          inAbyte := term.Rx
          if inAbyte == "o"  '' Turns on the LED at 26.
            term.Tx(inAbyte)
            misc.high(26)  '' Pin 26 on PropBOE which is an LED.
            CRLF
          if inAbyte == "f"  '' Turns off the LED at 26.
            term.Tx(inAbyte)
            misc.low(26)
            CRLF
          if inAbyte == "q"  '' Quit the program.
            term.Tx(inAbyte)
            CRLF
            term.str(string("Program Stopped",13,10))
            abort  '' Stop the program.
          '' This loop continues until you key in 'q' to leave the program. 
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
    '' This is a small example of the COG working as an independant function or
    '' job. The proof of this is, when you use the 'q' to stop the program, the LED
    '' keeps flashing. How do you stop it, hit the reset button, of course.
    PUB workLED
    
      repeat
        misc.high(27)
        misc.waitMS(500)
        misc.low(27)
        misc.waitMS(500)
          
    '' This is the simple way of dealing with this method. If you were to move this
    '' to the tools.spin object, then it gets a little more complicated, in order
    '' to make it work, any guesses as to why?
    PUB CRLF
      term.Tx(13)  '' CR
      term.Tx(10)  '' LF
    
    
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-06 05:08
    I have tried to show some very simple examples of Spin; as a new user the next thing that you have to consider is the hardware aspect. Right off the bat, because this is a Parallax domain, I suggest you look at the Parallax.com site for your hardware needs, although there are some third party choices available.

    Since I have been working with the Propeller from the beginning, yes I have a large variety of boards laying around to choose from. But, from a new user perspective I would highly recommend the Propeller Quick Start board, it is about the smallest investment that you can make, as you work towards making a decision as to whether the Propeller is a microprocessor that you want to pursue.

    I mentioned third party choices, these are: Propellerpowered, Gadget Gangster, MGH Design, and Wulfden. There are probably more, but these are the ones that I am familiar with.

    I believe I have supplied enough information that you can make a reasonable decision and pursue getting deeper into the Propeller world.

    Ray
  • TymkrsTymkrs Posts: 539
    edited 2013-07-06 19:09
    Anyone know what Mac OS's Simple IDE will work with? I have 10.5.8 (old I know) and I can't get either my PropBOE or Activity board to say hello to me with the example SimpleIDE program
    
    
    propeller-elf-gcc -I . -L . -I ../Learn/Simple Libraries/Utility/libsimpletools -L ../Learn/Simple Libraries/Utility/libsimpletools/cmm/ -o cmm/Welcome.elf -Os -mcmm -m32bit-doubles -fno-exceptions -std=c99 Welcome.c -ltiny -lsimpletools -ltiny -lsimpletools
    dyld: unknown required load command 0x80000022
    /opt/parallax/bin/propeller-elf-gcc error ... (1)
    
    
    propeller-elf-objdump -h cmm/Welcome.elf
    /opt/parallax/bin/propeller-elf-objdump error ... (1)
    
    
    propeller-load -Dreset=dtr -I /opt/parallax/propeller-load/ -b ACTIVITYBOARD -p /dev/cu.usbserial-A800KHBF cmm/Welcome.elf -r
    dyld: unknown required load command 0x80000022
    /opt/parallax/bin/propeller-load error ... (1)
    
    
    /opt/parallax/bin/propeller-load error ... (1)
    
    
    /opt/parallax/bin/propeller-load error ... (1)
    
    
    /opt/parallax/bin/propeller-load error ... (1)
    
    
    /opt/parallax/bin/propeller-load error ... (1)
    
    


    Is what I ended up getting in the build status window.
  • jazzedjazzed Posts: 11,803
    edited 2013-07-06 19:14
    Tymkrs,

    SimpleIDE and Propeller-GCC work with OSX-Lion and Mountain-Lion.
    Looks like SimpleIDE worked, but not Propeller-GCC.
  • TymkrsTymkrs Posts: 539
    edited 2013-07-06 19:18
    Anyway around it?
  • jazzedjazzed Posts: 11,803
    edited 2013-07-06 19:28
    Upgrade your OS, build Propeller-GCC from scratch (difficult), or get someone else with 10.5.x to build Propeller-GCC.

    Is your MAC Intel?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-07-06 19:33
    Tymkrs wrote: »
    Anyway around it?
    It almost looks like SimpleIDE is having trouble invoking command line programs. Can you try running propeller-elf-gcc directly from a shell prompt to see if that works?
  • David BetzDavid Betz Posts: 14,516
    edited 2013-07-06 19:52
    David Betz wrote: »
    It almost looks like SimpleIDE is having trouble invoking command line programs. Can you try running propeller-elf-gcc directly from a shell prompt to see if that works?
    Don't bother trying this. It looks like programs compiled for Snow Leopard and beyond will not run under Leopard. We would have to find a way to build another version of PropGCC (and SimpleIDE) for 10.5 to get this to work. Is there some reason you can't upgrade to a newer version of Mac OS X? If you can't we'll have to discuss with Parallax whether we need to support older versions of Mac OS X. Sorry you're having this trouble!
  • dgatelydgately Posts: 1,630
    edited 2013-07-06 20:06
    [QUOTE=jazzed;1193850
    Is your MAC Intel?[/QUOTE]

    Could you possibly run this in the Terminal and let us know what gets returned?
    ==> file /opt/parallax/bin/propeller-elf-gcc
    

    I get: "/opt/parallax/bin/propeller-elf-gcc: Mach-O 64-bit executable", which means propeller-elf-gcc is built for 64-bit only and works fine on my 1 year-old MacBook Pro, but will not run on 32-bit Macs. But, since you are running 10.5.8, I'm thinking that you should also have a 64-bit Intel CPU as that is a requirement for an 10.5.n builds. Let us know what gets returned...



    I should be able to help you in building a working propgcc, if you have the 10.5.8 developer tools installed.

    Well, "might"...


    dgately
  • TymkrsTymkrs Posts: 539
    edited 2013-07-06 20:07
    I'm cheap :p. It's a 8 year old mac (Intel) and would probably croak under the latest OS's. Oh well, at least my pc can work with it!
  • David BetzDavid Betz Posts: 14,516
    edited 2013-07-06 20:13
    dgately wrote: »
    Could you possibly run this in the Terminal and let us know what gets returned?
    ==> file /opt/parallax/bin/propeller-elf-gcc
    

    I get: "/opt/parallax/bin/propeller-elf-gcc: Mach-O 64-bit executable", which means propeller-elf-gcc is built for 64-bit only and works fine on my 1 year-old MacBook Pro, but will not run on 32-bit Macs. But, since you are running 10.5.8, I'm thinking that you should also have a 64-bit Intel CPU as that is a requirement for an 10.5.n builds. Let us know what gets returned...



    I should be able to help you in building a working propgcc, if you have the 10.5.8 developer tools installed.

    Well, "might"...


    dgately
    david-betzs-macbook-pro:src dbetz$ file /opt/parallax/bin/propeller-elf-gcc
    /opt/parallax/bin/propeller-elf-gcc: Mach-O 64-bit executable x86_64
    
    Looks like we're only doing a 64 bit build. I'm sure she will get the same thing since she's probably using one of our builds.
  • dgatelydgately Posts: 1,630
    edited 2013-07-06 20:21
    Thanks Dave, I wasn't sure if my propgcc was downloaded or built...

    Seems odd that running propeller-elf-gcc on 10.5.8 does not give a more informed error or a "nice" crash report. Unfortunately, I don't have any systems older than 10.8.n, else I could test and/or try to rebuild propgcc for 10.5.n.

    Tymkrs, Your'e not cheap, just "thrifty". Happily, Jazzed built SimpleIDE to run and look almost the same across OS types! So, your Win CPU is fine!


    dgately
  • RsadeikaRsadeika Posts: 3,837
    edited 2013-07-07 07:42
    This is my third installment of the test series, added some enhancements, and I implemented a case-sensitive command structure. I think I have enough comments in the source that I do not have to get into any detail here.

    There is one detail that needs to be discussed, the absence of a stand-alone program that could be called SimpleTerm. Maybe if we asked jazzed very nicely, he could make the resident terminal program that is within SimpleIDE also available as a stand-alone program. The reasoning behind this is, the terminal program has some built in commands for cursor control, and I think most of the terminal programs that are available will not respond to the SimpleIDE terminal commands. I would imagine, at some point people will want to save a testxx.prj to EEPROM and run the program as stand-alone, with some fancy cursor control.

    Now the question that should come up is, big deal, so what do I do with this program(s)? Well, I guess you could just delete everything, and move on to Forth. I figured what you have here is a very simple program that is command driven where you could add your own commands to do some fast and simple testing. For instance, on the PropBOE or the Activity board you have some servo connectors, you could write a method/driver for testing out a servo. Possibly create a command like tServo which would run your method/driver that you have come up with. That is just one example, remember you have breadboard, and other components like SD, XBee, ADC, ..., etc to work with, also.

    I just wanted to create this so some new users would have some real programs that would not scare them away. Now all you have to do is use your imagination, and read the manual for further instruction.

    Ray


    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    '' test3.spin
    ''
    '' July 6, 2013
    ''
    '' To be used with SimpleIDE in Spin mode.
    ''''''''''''''''''''
    
    '' This program is setup to use the PropellerBOE.
    '' The commands are now case-sensitive
    '' In SimpleIDE Spin mode you have to have a _clkmode and _xinfreq
    '' because the program is using a BAUD rate of 115200.
    CON
      _clkmode   = xtal1 + pll16x                           
      _xinfreq   = 5_000_000
    
    '' This program uses the terminal and some common tools, so
    '' to use them, label the objects.                                 
    OBJ
    
      term : "Extended_FDSerial"  '' An enhanced version of FullDuplexSerial (FDS)
      misc : "tools"             '' My object that contains some common tools.
    
    VAR
      long oneStack[10]  '' Most of the time 10 would suffice. 
    
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    PUB Start
      '' Setup EFDS for a 115200 BAUD rate.
      ''         Rx,Tx,Mode,BAUD
      term.Start(31,30,0,115200)
    
      Cog1 := cognew(workLED, @oneStack) ''This form is used to capture the COG ID.
    
      Main
    
    PUB Main | inSbyte,inAbyte '' Use local variables.
      misc.waitms(1000)  '' Pause the program for one second.
      term.str(string("Press CR to continue",13,10))
    '' Wait for a CR.
    
      repeat
        inSbyte := term.Rx '' Waits for a CR, if no CR is pressed then it repeats.
        if inSbyte == 13   '' If CR
          term.str(string("Menu: menu - this menu,  Quit - end program ",13,10))
          term.str(string("      onLED - LED on, offLED - LED off ",13,10))
        '' then start the main repeat.
        repeat
          term.Tx("#")  '' Instead of a blank line, a command prompt.
    '' The commands are case-sensitive
          term.RxStr(@inStrg)  '' RxStr() Accepts a string of characters - up to 15
          if strcomp(@inStrg, @stopProg)  '' Quit
            term.str(@inStrg)
            CRLF
            term.str(string("Program Stopped",13,10))
            cogstop(Cog1)  '' This stops the Cog
            abort  '' Stop the program.
          elseif strcomp(@inStrg, @onLED)  '' onLED
            term.str(@inStrg)
            misc.high(26)  '' Pin 26 on PropBOE which is an LED, is turned on.
            CRLF
          elseif strcomp(@inStrg, @offLED)  '' offLED
            term.str(@inStrg)
            misc.low(26)
            CRLF
          elseif strcomp(@inStrg, @mMenu)    '' menu
            term.str(@inStrg)
            CRLF
            mainMenu      
          else
            term.str(string("Invalid Command!",13,10))
    
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    PUB mainMenu
      term.str(string("Menu: menu - this menu,  Quit - end program ",13,10))
      term.str(string("      onLED - LED on, offLED - LED off ",13,10))
    ''''''''''''''''''''
    '' This is a small example of the COG working as an independant function or
    '' job.
    '' Pin27 on the PropBOE is used.
    PUB workLED
    
      repeat
        misc.high(27)
        misc.waitMS(500)
        misc.low(27)
        misc.waitMS(500)
    ''''''''''''''''''''      
    PUB CRLF
      term.Tx(13)  '' CR
      term.Tx(10)  '' LF
    
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    DAT
    '' The commands are case-sensitive, ex. - Quit is what works, and not quit.
    '' These values are stored in program memory
    inStrg byte "               ",0
    onLED byte "onLED",0
    offLED byte "offLED",0
    stopProg byte "Quit",0
    mMenu byte "menu",0
    
    Cog1 byte  '' Capture ID of started Cog. 
    '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    
  • potatoheadpotatohead Posts: 10,261
    edited 2013-07-07 10:44
    If you can go to 10.6, which isn't much different from 10.5 in terms of system resources, I can build PropGCC for you.
Sign In or Register to comment.