Shop OBEX P1 Docs P2 Docs Learn Events
I loooovvveeee spin — Parallax Forums

I loooovvveeee spin

SamMishalSamMishal Posts: 468
edited 2009-06-20 18:38 in Propeller 1
Hi All,
You can unscrew a Phillipshead with a flat head screwdriver you can also un-torque a nut with a pliers…………But why would you do that??
It is much better to use the right tool instead of a make-do tool for the job and unscrewing a screw with a Phillips or with a flat head screw driver is the VERY SAME action with the very same procedure to achieve the same result.
HOWEVER....with the tool suited and designed for the job it is a lot easier and more efficient and there is little chance of "screw-ups"....pun intended..................
The very same applies to SPIN in comparison to·other languages that have been designed for different platforms, different tasks and different processors.
SPIN is so well coupled (and PASM) to the Propeller Chip as well as being a superb language·inside a superb tool. Moreover, any "programmer" can learn it in a day or even less...
The argument that C or ADA or BASIC etc. are standard and a lot more people would be able to use them immediately IS FALSE. Whatever·language is used on a microcontroller has to have·PROPRIETARY considerations, settings,·register access and so on and so forth that have to be LEARNED and thus·would make the "standard" argument moot.
Programming constructs are the same regardless of the details of the syntax and SPIN is no different than any language in that regard. The time it would take to learn SPIN is no more than the time it would take to learn the SPECIAL PROPRIETARY considerations in C or BASIC or ADA that have to be·applied to the Propeller.............
SO WHY??????? not just learn SPIN in the first place since it is already in the ROM, it is OPTIMIZED for the propeller and is part of the MOST EXCELLENT Development Environment I have seen for even the most powerful IDEs out there......................
The advantages of using SPIN are NUMEROUS.......the disadvantages are NOTHING.......... so WHY BOTHER to use any other language?????????? Of course PASM for·TIGHTER TIMING would be the only other language that is worth looking at for the Propeller other than SPIN..........
I wholeheartedly applaud and admire all the people out·there that are doing all these remarkable efforts to make other languages fit into the Propeller...........however that reminds me of an old·story:
A person goes to the court of King Solomon and shows the wise king a trick where the guy balances 100 needles one on top of the other end to end and maintains the pile stable for a few minutes...... King Solomon applauds him and orders his treasurer to give the guy 100 shekels. However, with the same breath he also orders his guard to give the guy 10 lashes.....
The guy is shocked and begs for mercy and an explanation for such puzzling bipolarity in judgment. The wise king replies:
“The gold is to reward and acknowledge your undeniable skills. But the lashes are so as to remind you that you should have applied such dexterity to achieve a more useful task.”
Nevertheless, I am an old fool, and in my days we learnt to use the tools that came with whatever machine we were fortunate enough to be exposed to. We were equally content and ABLE to use the PDP11 or the VAX or the System/360 or the Apple II or the PET or the PC or the TI38 or or or……… we learnt to use Unix, LINUX, DOS, OS2, Windows, MVS, VMS, CPM and had to program in any language available like ASSEMBLY, Cobol, Fortran, Pascal, PL/I, VHDL, C, C++, VB, QBasic, Modula, Prolog, Lisp, Visicalc, Lotus123, Excel and many more that escape my dwindling memory. Things like IDE and DEBUGGERS were not even part of the vocabulary. The only DeBuggers were De Bosses.

So maybe my opinion might carry a little weight when I say :
Spin (+PASM) IS GREAT and it meets all the necessary criteria for being able to program the Propeller and I find no reason for ME to ever want to use any other programming tool for the Propeller the most SATISFYING microcontroller I have seen EVER.

Samuel
«1

Comments

  • RossHRossH Posts: 5,512
    edited 2009-06-18 01:16
    Hi SamMishal,

    I'm sure you won't be too surprised to hear that there are other opinions on this subject smile.gif

    I suppose your intention in posting (apart from just expressing your enthusiasm) was to initiate some discussion. So here goes ...

    I think everybody who discovers the Propeller is struck by how unique yet well engineered it is - both in hardware and software. And SPIN is certainly a good language for learning about the Propeller, for at least three reasons:
    • It is well suited to the Propeller's unique architecture.
    • It is easy for beginners to get started, and allows very impresive programs to be written with surprisingly little effort.
    • It provides a simple and well structured pathway down to assembly language, which is where a lot of work has to be done on the Propeller. Assembly language programming is always difficult, but SPIN at least gives you quite a good 'soft entry' point.
    Obviously all these things are by design, and the result is a credit to the team at Parallax.

    However ...

    Some of the reasons you end up doing so much work in assembly language on the Propeller can be traced back to the limitations of SPIN. SPIN has some disadvantages that are simply showstoppers in some circumstances. Here are just a few (no particular order):
    • It is interpreted, and therefore too slow for many applications, requiring much of the real work of the application be written in assembly language anyway.
    • It has no floating point support, no structures and (almost) no data types - all of which significantly complicate the task of writing even moderately complex software.
    • It provides little support for higher level software engineering activities. For example, in SPIN it is difficult to even define global constants, let alone share modules (other than in source form that require manual customization), create re-usable code libraries, or support conditional compilation based on platform differences.
    • It has some peculiar obscurities and 'gotchas' all of its own - e.g. using indentation for scope, or using => in place of <= (which is accepted but means something altogether different).
    It is also not true to say that other languages cannot be used on a microcontroller without proprietary extensions. Most microcontrollers support multiple languages - and all of them probably get used. The most common one is probably ANSI C - it is supported on nearly all computers, from microcontrollers (including the Propeller) to supercomputers - with no proprietary extensions to the language at all. The reason C is so popular is precisely because it does in one language what SPIN has to resort to PASM to accomplish - i.e. it provides a high level language with access to low level features, suitable for manipulating bits and bytes, I/O registers and the like. The result is not as fast as pure assembly, but not as slow as SPIN. And it's a lot more portable.

    In the early days of computing many people (and companies) developed their own proprietary languages because existing ones did not suit their particular need. But it's been a long time since that has been the case. Most of proprietary languages end up in one of two ways - the useful ones end up becoming widely adopted (like C). The others end up as quaint historical footnotes (like MUMPS). With absolutely no disrespect to SPIN, if I had to bet which way it would end up, I know where my money would be.

    My own company provides a fairly good real-world example of why C is (in at least some cases) preferable to languages like SPIN. We're only a small niche equipment supplier, but we sell many tens of thousands of units - based on various types of microcontroller - each year. ANSI C is used on every one. All our standard product functionality (incluiding low level things like comms protocols and the like) are implemented in C. We would not even consider adopting a microcontroller that did not support it, because the amount of retraining and rework would be too great. Also, having to support a different proprietary language on each micrcontroller would not only multiply our initial one-off development costs, it would also multiply our ongoing support costs. To the extent that we would probably no longer be competitive in our chosen market. Proprietary languages are simply not appropriate in situations such as this.

    SPIN is a great language for learning about the Propeller, and is suitable for quite a few commercial applications. But it doesn't suit everyone's needs.

    Anyway, why limit your toolbox to only a screwdriver or two? Tackling a complex job with limited tools only ends up making it more difficult.

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • RossHRossH Posts: 5,512
    edited 2009-06-18 02:10
    @all,

    You may have noticed that I manfully avoided picking up on SamMishal's slighting reference to Ada - which is unusual for me!

    But just after posting the above I got an email from Libre - Ada is now available for Lego Mindstorms!

    See http://libre.adacore.com/libre/tools/mindstorms

    Soon your five year old will be learnng Ada as their first computer language.

    I've got to get back to working on my Ada compiler for the Propeller!

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-06-18 03:53
    SamMishal said...
    SPIN is so well coupled (and PASM) to the Propeller Chip as well as being a superb language inside a superb tool. Moreover, any "programmer" can learn it in a day or even less...
    I would like to know exactly how I can learn SPIN in a day or less.

    humanoido
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-06-18 04:04
    humanoido,

    There's no magic pill you can take to learn Spin in a day. And I'm not sure why you'd want to, since the journey itself is so pleasant. But, if you must, here's the formula:

    Get up early. Hit the ground running with an LED blinker program. Make mistakes. Query the forum. Fix your bugs. Lather. Rinse. Repeat. Burn the midnight oil. One day. No problem!

    -Phil
  • SamMishalSamMishal Posts: 468
    edited 2009-06-18 04:39
    humanoido said...
    I would like to know exactly how I can learn SPIN in a day or less.
    Well, assuming you are an experienced·programmer.......you would need to do·the following:
    • Read the manual.........go through all the constructs and language elements such as operators, if-statements, etc. only 237 pages, which you do not
      really need to read in details in this step. You can download the manual as a PDF.
    • Get the most excellent development kit PEK (Propeller Education Kit) and go through it. You only really need to go through to end of chapter 6
      (118 pages). Do the experiments but also change them to do a slightly different action. Again use the manual but also read the text in this PEK manual
      with great attention.
    • If you do not want to spend the money then download the PEK manual and read it......but you DO NEED to do the experiments so you need some
      programming board.
    • Get your hands on as many written programs (well documented) and go through them. Try to modify them slightly and then a lot.
      Use the manual with this process and refer to all the elements that you cannot quite grasp while reading the programs. This is where you spend a bit
      more time reading the pertinent manual entries. There are many example programs in the PEK manual downloadable PDF.

    Obviously if you are not an experienced programmer you can still do all the above but you won't be able to do it in a day. Take your time and let the concepts sink in
    before you move on to the next one. 2 weeks to·4 weeks depending on the level of your experience.

    If you are a novice then I advice you use the BS2 for a while before you move to the Propeller. The propeller is best appreciated when you have already
    experienced the limitations of other single processor controllers.



    Samuel
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-18 04:46
    humanoido,
    Remember that learning the Propeller is much more than learning Spin. Understanding the use of multiple processors may take an "ah ha!" moment, particularly some of the ideas involved in sharing memory between processors. Fortunately, most use of the Propeller's multiple cogs is for I/O where the additional cog(s) are hidden by the I/O object from the part of the program you write. For example, if you're using a VGA text display plus a keyboard, plus an SD card and maybe a full duplex serial I/O port, you're already using 6 out of 8 cogs, but you're only dealing directly with one of those. The others are started when you initialize each of the I/O objects (2 for VGA, 1 for keyboard, 1 for serial, 1 for SD card and EEPROM access, and 1 for the main program).
  • MagIO2MagIO2 Posts: 2,243
    edited 2009-06-18 11:56
    @homanoido:
    Have a look at the list of programming languages that SamMishal already used. So, learning SPIN itself only means to have a look at the table of commands and operators it provides. That can be done in a day or a half ;o) SPIN has no concepts that are completely new.

    This changes a little bit, if you want to learn PASM. Even the experienced programmers need some more hours to learn real good PASM coding.
  • Jim FouchJim Fouch Posts: 395
    edited 2009-06-18 13:10
    Back in May of 2006 I got my first Propeller Demo Board. I sat down at 8am on a Saturday to start PLAYING with it. 15 hours later when I had to go to bed I had a good grasp of what SPIN was and how well coupled with the Propeller it was. It was a great time and brought back memories of playing with 8-bit computers in the 80's.

    I wouldn't want to write the next major PC type application in it. But for what it does, it does it very well.

    For contrast, I have used other chips that use Basic and have taken a lot longer to get them to do what I wanted.

    Maybe some people are more open to a new way of doing things and others are not.

    I work for a living in VS .Net 2008 10-12 hours a day and use VB while others I work with think I'm crazy for not using C#. But they are really the same at the core; it's just a preference of language. I choose VB because I can code faster in it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jim Fouch

    FOUCH SOFTWARE
  • ericballericball Posts: 774
    edited 2009-06-18 13:16
    MagIO2 said...
    @homanoido:
    Have a look at the list of programming languages that SamMishal already used. So, learning SPIN itself only means to have a look at the table of commands and operators it provides. That can be done in a day or a half ;o) SPIN has no concepts that are completely new.

    This changes a little bit, if you want to learn PASM. Even the experienced programmers need some more hours to learn real good PASM coding.
    I'd argue the reverse was true for me.· PASM took very little time for me to start working with, while I'm still learning how to read SPIN code skilled coders have written.· I think the latter is because of the large number of SPIN unique operators.· IMHO, the big mental hurdles with PASM are the register/instruction RAM·equivalence and the use of self-modifying code for indirect addressing.· But, for someone who has "coded to the metal" with more than a few processors - PASM is reasonably easy to learn.

    And, on the subject of other languages.· Although I understand the value of being able to re-use code across multiple platforms - doing so drags along certain assumptions about the platform.· Assumptions which are probably not correct for the Propeller.· Therefore, although it may be possible to write a compiler / interpretter for the Propeller, doing so is the classic square peg in a round hole.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Composite NTSC sprite driver: http://forums.parallax.com/showthread.php?p=800114
    NTSC color bars (template): http://forums.parallax.com/showthread.php?p=803904
  • HumanoidoHumanoido Posts: 5,770
    edited 2009-06-18 13:38
    Thank you for the important considerations and a helpful preview into the Propeller operating architecture. I am making a considerable commitment to the Propeller chip based on all of these suggestions.

    humanoido
  • KyeKye Posts: 2,200
    edited 2009-06-18 14:51
    What if the spin interpreter was ported into c code...

    (I like the multi colored section in the editor and how the operators work)

    ... and then suport for data structures were added.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nyamekye,
  • SamMishalSamMishal Posts: 468
    edited 2009-06-18 15:18
    When the first internal combustion engine was invented some said… aha… this is a good motive ·propeller…..
    if we stick a horse buggy on it we can call it a horseless carriage……
    I do not know if you have seen them, they are the most ungainly looking contraption.
    With the Propeller Chip the good people at Parallax had the foresight to invent the driving compartment (SPIN)
    along with the motive propeller (Propeller chip) and this driving compartment is streamlined, comfortable, good
    looking, has all the right switches and necessary instrumentation all set out in a perfectly ergonomic arrangement
    and FITS PERFECTLY on top of the engine.
    Yes a person used to driving “horse buggies” might find it difficult to drive this new machine at first but then if he/she
    goes to the trouble of learning while shedding old habits it would enable them to move into the 21st century paradigm
    for microcontrollers.

    Samuel
    ·
  • BradCBradC Posts: 2,601
    edited 2009-06-18 15:58
    While I agree with you Sam, you are flagellating the deceased equine. Alternative languages do have their place.

    Picture a company with loads of legacy code written in C. Do you rewrite it completely in Spin/PASM or do you use a non-native environment and compile it from that?

    Personally I'd rewrite it in Spin/Pasm, but then I don't get many paying software gigs because I take too long being that I'm a little bit obsessive about speed and size.

    Most pragmatic people would find a way (usually involving a shoehorn and vaseline) to massage their existing code to run on the new chip. This is actually a valid reason and there are obviously people who want to do this (witness two C compilers). This is ok. Diversity is good!

    Some people use alternatives out of pragmatism (I have 10,000 lines of Fxx code and I want a platform that will support that), some from inertia (I can program in BASIC, it's all I've ever done and I ain't gonna learn some new fangled language so someone - not me as I'm too lazy - write me a BASIC compiler damnit!). Both are valid from their own points of view. Others use what is best for the job at hand..

    Arguing about it is simply a waste of bandwidth. You honestly won't convert anyone but you will consume a load of time trying.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Missed it by ->" "<- that much!
  • PraxisPraxis Posts: 333
    edited 2009-06-18 18:04
    Hi Sam,

    Whilst I can appreciate that Spin gives you some wood take some time to think about the market segment that would use Spin.

    This I guess opens the debate between commercial and hobbyist users.

    Just a random thought.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Caelum videre iussit, et erectos ad sidera tollere vultus

    Certe, toto, sentio nos in kansate non iam adesse
  • SamMishalSamMishal Posts: 468
    edited 2009-06-18 18:40
    Praxis said...
    Hi Sam,

    Whilst I can appreciate that Spin gives you some wood take some time to think about the market segment that would use Spin.

    This I guess opens the debate between commercial and hobbyist users.

    Just a random thought.

    You are absolutely right...........a hobbyist is not experienced enough and therefore is limited to using
    the language or chip he knows best and actually has the luxury to do so.
    ·
    A professional has the experience to be able to adapt to anything thrown at him, besides not having
    the luxury to refuse a job because he does not like the language or chip the client is insisting the job
    should be in.
    ·
    One of the reasons companies go out of business is that they do not keep up with the relentless march
    of technology. In the real industry we are always sending employees for courses and seminars in order
    to keep their knowledge and skills up to date so why not use these sessions to also teach them
    NEW stuff that would give us the edge in the LONG RUN even though it may not satisfy the drive for
    immediate ratification and the incessant need for profit at any cost.

    Sam
    ·
  • waltcwaltc Posts: 158
    edited 2009-06-18 19:09


    This I guess opens the debate between commercial and hobbyist users.



    RossH pretty much nailed the difference between the two and its a big one.

    C is pretty much the embedded HLL standard whether people like or not. I just don't see SPIN going anywhere in the commercial world given that its tied to a single sourced micro.

    It might be different if Chip rolled out SPIN versions for ARM or AVR's but that would kill sales for the Basic Stamp line.
  • jazzedjazzed Posts: 11,803
    edited 2009-06-18 20:05
    @Bradc, I swear at first glance that you wrote flatulence while riding a horse [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve


    Propalyzer: Propeller PC Logic Analyzer
    http://forums.parallax.com/showthread.php?p=788230
  • CounterRotatingPropsCounterRotatingProps Posts: 1,132
    edited 2009-06-18 23:17
    jazzed said...
    @Bradc, I swear at first glance that you wrote flatulence while riding a horse [noparse]:)[/noparse]
    lol.giflol.gif
    waltc said...
    This I guess opens the debate between commercial and hobbyist users.

    RossH pretty much nailed the difference between the two and its a big one.
    I agree, waltc. Several times it comes up on the forums something like "why should I learn C?" - and the replies split along just that line. Hobbyists may want to learn it to improve or may not want to because they don't *have to* for their projects. Whereas commericial users, or professional programmers, must know C at least to get their foot in the door of the great majority of shops. Granted, folks like Jim Fouch or ericball, may not actually need to use it day to day, but I'll bet it's on their resumes (right guys?). Most places give a test for entry level programmers, and many managers want to see sample code. If you showed them SPIN, you'd probably not be called back for a follow up interview.· And in bit-weenie shops where you code in asm only, you still have to know C because most of the tools and extensible toolsets are in C for both legacy and cross-platform reasons.
    RossH said...
    ... we sell many tens of thousands of units - based on various types of microcontroller - each year. ANSI C is used on every one. All our standard product functionality (incluiding low level things like comms protocols and the like) are implemented in C. We would not even consider adopting a microcontroller that did not support it, because the amount of retraining and rework would be too great. Also, having to support a different proprietary language on each micrcontroller would not only multiply our initial one-off development costs, it would also multiply our ongoing support costs. To the extent that we would probably no longer be competitive in our chosen market. Proprietary languages are simply not appropriate in situations such as this.

    That RossH is writing a solid C compiler for the Prop will benefit us all - if for no other reason than it will make the Prop more quickly available to a wider set of users, including commercial vendors who are invariably impressed with the Prop when they first take a serious look at it. (IMHO).· And the more Parallax sells it, the more benefits come round to us.· SPIN is a good fit for the Prop - and Parallax was brilliant for writing it - because it makes the Prop more widely accessable to the hobbyist - so we spin round full circle, eh?

    - Howard

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "This device contains recyclable materials, which can be re-decomposed

    and re-integrated into brand new marvels... We strongly encourage you
    to contact the provided information and recycle yourself always. "
  • localrogerlocalroger Posts: 3,452
    edited 2009-06-19 00:27
    waltc said...
    C is pretty much the embedded HLL standard whether people like or not. I just don't see SPIN 
    going anywhere in the commercial world given that its tied to a single sourced micro
    
    


    I strongly disagree with this. While I'm not quite as high on SPIN as Sam, I don't see a slavish devotion to C as a virtue. Spin/Pasm is the language system for optimized development on the Propeller chip. It's very well designed for that, despite a few annoyances on the Spin front such as the inability to make a jump table and difficulty accessing common resources from multiple levels of object depth. Much of what is annoying about Spin could be cured with a secondary Spin-like compiler that compiles to Spin byte code. Other paradigms like the LMM (and by extension C-like languages that compile to it) might have a place for some applications, but most of those alternate systems are neither as memory efficient as Spin nor as fast as Pasm, and as efficient as allocating the Prop's weird mix of resources as neither.

    I work in an industry that is constantly inventing new pidgin languages because of regulatory and resource limitations; in my career I've used three different languages that started out as macro languages with one ascii character commands, a variant of C tacked onto one of those in the way PASM augments SPIN, a virtual clone of Visual Basic at the source level except that it does not support parameter passing or local variables and all the optimizations and event handling are totally different than in VB (and the manufacturer doesn't document any of this), and a pidgin version of Pascal. I have also written three interpreters and two compilers of my own for specialized applications. Writing and learning new languages isn't (or shouldn't be) all that hard, and on a limited platform like the Prop there really is no substitute for a language designed from the ground up to make optimal use of the platform resources.
  • BradCBradC Posts: 2,601
    edited 2009-06-19 00:59
    localroger said...

    I strongly disagree with this. While I'm not quite as high on SPIN as Sam, I don't see a slavish devotion to C as a virtue.

    Actually, I second that. Moons ago people used to pay attention to code size, efficiency and power consumption. Now days it generally appears that the priority is on quick & cheap, so there is little thought put into how the code actually fits a platform and more onto whether existing code can be fitted to a platform with little changes. Witness the plethora of bloatware programming languages these days. (VB I'm looking at you)

    In some ways I guess it's good as it gets more people exposed to programming, and in some ways it foists upon us VCR's that draw 5W when in standby doing nothing as the twonk who wrote the code did not know enough to put the platform to sleep and leaves it in a loop waiting for the wakeup.

    Walt and others are right. C is the defacto embedded HLL. It's like English really, it's lowest common denominator and most grads can cobble enough of it together to get something working. It's here to stay and as evidenced by the fact there are now three C compilers for the Propeller, it's in demand. This is something we should support as it will help promote the Propeller in general as a platform.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Missed it by ->" "<- that much!
  • localrogerlocalroger Posts: 3,452
    edited 2009-06-19 01:43
    @BradC -- Spin is to the Prop what C was to the PDP-11. C and Spin are really quite similar in their limitations, cf. crappy string support and no floating point math. Spin is slower because interpreted but also far more memory efficient than C on a 32-bit platform. I have always HATED HATED HATED the ignorance of whitespace and curly bracket abuse potential of C and C-like languages, and while Spin goes overboard in the opposite direction I think it's great for education because if you don't figure out how to properly indent your code, it doesn't work. I know people who have been programming in C-land for 20 years who still write code only the machine can read. Spin is designed to discourage that, and I know exactly why Parallax did that.

    That our standard HLL (and calling C a HLL is quite a stretch) was written to be compiled by and run on a 16-bit CPU with a 32K memory limit really says something, and while I'm not sure what it does say exactly I'm sure it isn't good.
  • RossHRossH Posts: 5,512
    edited 2009-06-19 02:10
    BradC said...
    localroger said...

    I strongly disagree with this. While I'm not quite as high on SPIN as Sam, I don't see a slavish devotion to C as a virtue.

    Actually, I second that.
    Actually, I second that as well. I'm not building Catalina because I'm slavishly devoted to C smile.gif - I'm doing it because it is a necessary step along the way to being able to do what I personally want to do with the Propeller - which actually has very little to do with C. I also happen to think C support will ultimately prove to be good for the Propeller, but I'm willing to accept that others may disagree on that point.
    localroger said...
    Much of what is annoying about Spin could be cured with a secondary Spin-like compiler that compiles to Spin byte code.
    I'm not sure I understand your point here - SPIN is already a Spin-like compiler that compiles to Spin byte code. So is bstc, so is Homespun. Did you mean a Spin-like compiler that compiles to PASM, or did you mean a NON-Spin like compiler that compiles to Spin byte code?

    If you meant the former, I agree that would be a nice thing which would significantly enhance the usability of SPIN. If the latter, then various people have proposed other compilers that would compile to Spin code. Form my (personal) perspective the main problem is that I don't believe the Spin byte code is sufficient to implement the whole of ANSI C - so the result would just become YACLL - i.e. "Yet Another C-Like Language"
    localroger said...
    C and Spin are really quite similar in their limitations, cf. crappy string support and no floating point math.
    Standard C (whichever standard you want - K&R, ISO, ANSI) has floating point maths. Only YACLLs do not. I won't argue about the "crappy" string support. smile.gif

    I also agree about C not being a HLL. C was specifically designed as a portable, machine-independent alternative to using assembly language. It was designed to do the same job that many people have to do on the Propeller using PASM (or a combination of SPIN and PASM). It fills its particular niche quite well - although naturally it is never as efficient as the native assembler on any particular platform. This is why it is still around - virtually unchanged - after 40 years (much like me smilewinkgrin.gif).

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • HollyMinkowskiHollyMinkowski Posts: 1,398
    edited 2009-06-19 02:48
    Where I work C is the only language used to program ARM and AVR.

    I convinced them that the Propeller chip could save money and simplify several tasks that are
    difficult and expensive. I will be the only one programming the propeller and what I'm going to
    do is take a black box approach. The propeller will handle some critical timing chores and kbrd
    and video. The project I'm working on now used an ATmega644 and a pre-configured laptop/netbook
    to communicate with the boards and check status, change functions..etc. I'm pretty sure that I can
    create a black box with the propeller and control it from a cheaper Atmega168. The use of
    the propeller will eliminate the hassle and expense of the laptop at a cost of about $20 for
    the propeller and a few parts that it needs and a small lcd monitor. Also the 168 chip is less than half what the 644 costs
    so that gets deducted from the total. Small LCD monitors are cheap from China and can be replaced by
    those monitors for car DVD players if need be.

    I will document the functions of the propeller in the design and detail the communications protocol
    the 168 will need to use to control it.

    Basically this means that the project is still programmed in C and can be modified by anyone here because
    the Spin and PASM are handled and debugged by me and don't need to concern any one else as long as I
    do my work well.

    Saving $ is always job #1. If everyone here had to learn Spin and PASM they never would have considered
    using the propeller.

    The propeller will be used around here as a customizable video, kbrd, mouse, hi-res timer chip. It seems to
    do these things so well and so cheaply that is would be silly to spend the $$$ to duplicate the capabilities in
    many projects using more expensive processors.
  • jazzedjazzed Posts: 11,803
    edited 2009-06-19 02:51
    This is not meant as a jab at anyone here ... a direct jab at a recent interviewer though. I've met many "professional" C programmers who are "don't wanna be C programmers" and often say "we want a maintainable code base here" as an excuse for their misunderstanding or limited knowledge of the language. I don't want to be around those types since it is probably an "ice-burg sign" anyway. The biggest crime in a shared code base is inattention to detail ... but with a "serious and through" source review process even that can be caught before commit (except when you have people that insist on just changes because they can't read pointer math or whatever).

    That being said, and don't take this badly localroger especially since I've read and enjoyed your many well informed posts ... if you can't read C programs that "only the machine can read", then you're probably a Pascal programmer or something else at heart anyway [noparse]:)[/noparse] Most people I know when given the chance would just re-write the function if performance was not a consideration or provide a reasonable comment interpretation otherwise. The only C programs that I can't stand to read are the ones where every single line starts on column zero ... some newbie computer science students from last year ... ugh. Spaces and tabs intermingled in the same source function/file also drives me nuts or just finish the day early.

    Learning many languages is the best path to a more successful understanding and application of computer programming once your past the basics. Some "one language programmers" are so full of themselves, that they would insist on your using their toilet seat as your kitchen table.
    You can't imagine the number of elegant pieces of C code I've been shown with overflowing pride from the author ... all you can do is smile and move on if you're in a subordinate position. Following someone's silly set of coding rules is probably the best way to keep a good paying job though ... if that's what you want. Follow whatever path has been laid before you until your heart takes over ... if your wallet can stand it [noparse]:)[/noparse]

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Steve


    Propalyzer: Propeller PC Logic Analyzer
    http://forums.parallax.com/showthread.php?p=788230
  • waltcwaltc Posts: 158
    edited 2009-06-19 03:01
    My personal preference is Oberon, Delphi and Power Basic.

    But I have no devotion to C at all, all I'm doing is stating a fact of life. You want the Prop to be accepted in the corporate world you need a good C compiler along with a host other tools such as those offered in eval kits from Keil or IAR.

    That is where the mindshare is, not with interpretive languages like Spin unless its on a Linux or Windows box doing script work.

    That said, I don't like C, its a language designed by a stutterer and obscurantist who couldn't decide whether it was to be a glorified macro assembler or a true HLL(it isn't IMO). And a lot of C code is dreadful, just short of Smile, it made assembly look good by comparison.

    Hobbyists though IMO are better off with Spin or perhaps a major rewrite of it that includes structures, string handling, strong type and bounds checking, etc.
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-19 03:46
    In some ways, this discussion is very amusing. I've heard it so many times with different names. Cobol was definitely the "Lingua Franca" of professional non-scientific programming for a long time with PL/I trying to replace it as the universal language at one point. Algol 60, Pascal, and others came along, were well used and supplanted. C has been around for 40+ years and is aging a little in that it has some bloat associated with it some of which has been spun off into C++ and its cousins.

    One thing this discussion has glossed over is that the Spin interpreter was specifically designed to fit in 496 32-bit words of cog memory. As several people have found, it can be sped up. It can be enhanced in terms of features, but not in 496 words. There is no reason why a C interpreter for a compact byte code can't be written that's roughly the same speed or a little faster than the Spin interpreter for equivalent code, but it won't fit in 496 words. The Spin interpreter could be used to execute code compiled from C. Things like structure access would likely be a tad slow, but that may be ok for most users. A byte code interpreter optimized for C could be built as well. With a little work, it could be done so byte codes and LMM-style code could be mixed for speed and even small loops and other time-sensitive code could execute out of a cache as native cog code. It's all a matter of "how much do you want it?" How much are you willing to pay someone else to do it for you or how much sweat equity are you personally willing to put in to do it yourself. We've been very lucky to have so many talented and inspired individuals including ImageCraft for going out on a limb to build a commercial grade version and to do it first.
  • grouchygrouchy Posts: 16
    edited 2009-06-19 03:56
    Just a note from a hobbyist, not a professional programmer. I just got a propeller demo board 3 days ago. I wanted to learn a little about microcontrollers and started out with a TI ez430 because of the low cost to get started, but because of my inexperience I found getting started a daunting task. I was able to blink a led and connect a 4bit lcd, but nothing was easy and I finally gave up after I/O pins didn't do what I wanted and help is impossible to find.

    I decided to try the propeller, and I'm quite pleased. In two days of playing with the demo board, I can control the leds, I've connected a keyboard, a video display, and I've patched together the 4 bit lcd display. Now on to a sd card. And I understand the spin. Learning the IDE couldn't be easier, in contrast to the ez430. All that in 2 evenings!
    Jim Fouch said...
    It was a great time and brought back memories of playing with 8-bit computers in the 80's.
    what he said.......


    for a hobbyist, the software and hardware resources are easy to find.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Rudy's CNC Freeware·· http://www.enter.net/~schleinkofer

    Post Edited (grouchy) : 6/19/2009 4:22:43 AM GMT
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2009-06-19 04:00
    I'd be "grouchy" too if I had started out with the "TI ez430" [noparse]:)[/noparse]

    Welcome to the Propeller! Sounds like you are off to a flying start!

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Visit the: The Propeller Pages @ Warranty Void.
  • RossHRossH Posts: 5,512
    edited 2009-06-19 04:23
    @Mike,

    Yes, we seem to go over this ground again and again - usually when someone new "discovers" the Propeller. But I think this is a good thing - it makes it fresh for all of us all over again. I remember my own Propeller "wow" moment very well shocked.gif

    To take up a couple of your points ... in a way, the longevity of C is in part because it has kept the core language intact, and instead spun off things like (ugh!) C++. You could compare this against other languages that have laid claim to various parts of the real-time/technical computing domain, including Modula (... Modula-2 ... Modula-3 ...) and Ada (Ada 87 ... Ada 95 .. Ada 2005 ...) - fairly obviously, that way lies eventual oblivion.

    Okay, so C is not as "lean and mean" as it originally was - but then the same is probably true of ourselves smile.gif

    The idea of a byte-coded language for the Propeller comes up again and again - but I can't see why any of them would be any more compelling than SPIN, which I think we all readily acknowledge is pretty much the ideal solution in that space. The only other language that I think would make sense would be Java - for similar reasons as are mentioned for C (i.e. that it is ubiquitous in its chosen domain). Of course, Java is not immune to "bloat" and it may be that a Java byte-code interpreter - plus all the additional libraries and other junk it requires - would be so large and resource hungry as to be fairly pointless on the Prop.

    All of which brings us back to SPIN for those that are memory constrained, but are willing to accept the limitations of interpreted languages in return for very efficient memory utilization, and C for the rest. I think this is a pretty good combination. I'm fairly sure richard (Imagecraft) would agree.

    Ross.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Catalina - a FREE C compiler for the Propeller - see Catalina
  • localrogerlocalroger Posts: 3,452
    edited 2009-06-19 12:46
    @jazzed -- I take your point, and I would not argue that it's impossible to write clean C code; I've seen very well done C code which flows naturally and where the use of whitespace and placement of braces make it obvious where all the loops and entry and exit points are.

    But because C enforces no whitespace restrictions at all, there are three or four totally different ways to do that, all internally consistent yet all different from one another. Sometimes it's appropriate and elegant to roll a short loop onto a single line in technical violation of the going style, but the ability to do that is sometimes abused to create what looks at first glance like a long string of random ASCII characters. Sometimes you start with a short elegant loop, and in the debugging and extension process it becomes a melange and because it emerged incrementally everyone understands it and nobody bothers to unravel it for the future n00bs who will look at it and go WTF.

    You also have the guys who never seem to learn just how to match indents with outdents, or who think it's just fine to end a long block of nested structures with this: }}}}}}}} Now which of those braces terminates the third level FOR loop? Languages like Spin and for that matter BASIC don't let you do that, and no language should.

    I don't have a problem with pointers; they're necessary for performance. People should probably be required to learn some form of assembly language before being allowed to learn C so that they will understand this.

    I still remember very clearly the day I decided to learn C and read, in the first chapter of the book, that C ignores whitespace and considers the program a linear stream of characters. My immediate thought was "that is the stupidest idea I have ever heard," and I still think that 30 years later. Fundamentally, a program is not a stream of characters; it is a list of instructions, and the usual way we present lists is one item per line.
Sign In or Register to comment.