PDA

View Full Version : I need to use C language.



markuster
07-03-2009, 10:44 PM
Hi,


I want to buy the Propeller but I don't want to buy the C compiler.

I saw that the trial version is 45 days. After 45 days the the code is reduced to 2k.

But I would like to know if there is an other difference with the commercial edition.


Thanks, Mark.

Ale
07-03-2009, 11:16 PM
Try Catalina

Edit: I just went to pick the link... http://forums.parallax.com/showthread.php?p=795326 but someone posted it alread http://forums.parallax.com/images/smilies/jumpin.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit the home of pPropQL: propeller.wikispaces.com/pPropQL (http://propeller.wikispaces.com/pPropQL)
pPropQL020: propeller.wikispaces.com/pPropQL (http://propeller.wikispaces.com/pPropQL)
OMU for the pPropQL/020 propeller.wikispaces.com/OMU (http://propeller.wikispaces.com/OMU)

parts-man73
07-03-2009, 11:17 PM
There's also Catalina C - http://forums.parallax.com/showthread.php?p=795326

LOL - looks like someone beat me to the post http://forums.parallax.com/images/smilies/tongue.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Brian

uController.com (http://uController.com) - home of SpinStudio - the modular Development system for the Propeller

PropNIC (http://uController.com) - Add ethernet ability to your Propeller! PropJoy (http://uController.com) - Plug in a joystick and play some games!

SD card Adapter (http://uController.com) - mass storage for the masses Audio/Video adapter (http://uController.com) add composite video and sound to your Proto Board

StefanL38
07-04-2009, 12:07 AM
Hello Mark,

if you want to save money learn SPIN. The programming-language delivered for free with the propeller
SPIN is close to C. If you are a good programmer in C
you will learn SPIN within three days.

If you are no c-programmer yet it will take you 8 weeks to learn some C
and it will take you just 3 weeks to learn a lot about SPIN

best regards

Stefan

Nick Mueller
07-04-2009, 12:38 AM
> SPIN is close to C.

Sorry to be so frank. But you either don't know C or you don't know SPIN.
Or both. http://forums.parallax.com/images/smilies/wink.gif

SPIN is lightyears away from C, even from stripped down dialects like TinyC or such.


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

jazzed
07-04-2009, 12:40 AM
To "really" learn C takes more than a year :)
Two semesters of C classes is just the beginning knowing C.
Such a big investment one of many reasons it's hard to let go :)

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


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)

Mike Green
07-04-2009, 12:48 AM
Nick,
Sorry to disagree, but I've said several times before that Spin is close to C and I still believe that.

1) The basic units are the hardware storage units (byte, word, long word)

2) The basic operations are the "hardware" operations. Even if you just consider the actual operations supported by the native cog instructions, most of the operators have direct instruction equivalents

3) The control structures are fairly primitive (though very convenient) and easily translated into efficient code

4) Overall the language is well matched to the underlying hardware

Nick Mueller
07-04-2009, 01:07 AM
> Sorry to disagree, but I've said several times before that Spin is close to C and I still believe that.

What clearly makes the difference is (inclomplete list):
* rich set of types, even richer with ...
* typedefs
* structures, unions
* includes
* type-checking

Sorry, I don't want to start a flame-war. But when I read that C is close or similar to SPIN, I'm going nuts. Completely nuts! http://forums.parallax.com/images/smilies/smile.gif
I started C at about 1980. Initially I hated it (that was my Pascal/Modula-time, for an excuse). But as time went by, I liked (I don't love C) it more and more. And clearly prefer it over C++.

I'd pay $$$ for ObjectiveC on the propeller. http://forums.parallax.com/images/smilies/smile.gif

Peace!
Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

jazzed
07-04-2009, 01:13 AM
Mike's right except for Spin's:
lack of data structures
lack of strong data type function signatures
lack of function pointers
lack of native preprocessor support
lack of typedefs
extra array looking bit manipulation statements
larger number of strange operators
lack of ternary conditional operator
different arithmetic order of operation rules with binary shift
Visual Basic like comments
usage of braces for comments
Visual Basic like equality comparison
the strange idea that =< means less than or equal to
the strange idea that => means greater than or equal to
tilde ~ meaning somthing other than binary not
using "repeat n for" instead of the "for" syntax
using repeat instead of while
having an "ifnot" statement
having a way to reference object functions without manually building data-structure pointers
useful idea that whitespace indent is required even by freshmen programmers :)
using " " to define a byte character
using $ for hexadecimal notation
allows strange number notations like % for bits, %% for nibbles
allows using "_" in numbers much like verilog
and last but not least requiring the string statement to declare a string like "hello world"

This is not a criticism of spin, it is just a list of differences (incomplete i'm sure) for someone who might know C and would consider learning spin.

Cheers

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


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)

SamMishal
07-04-2009, 01:14 AM
Hi Mark,

SPIN is the language of the Propeller. Actually it is PASM but the Propeller is a very
able bilingual and Spin is its 2nd equally versed language.

If you were able to speak to a person in his native tongue would you not
prefer to do so than if you had to have to hire a third person to do so for you?

Of course this is predicated upon you being able to learn the native tongue easily.

If you are a versed programmer you should be able to VERY EASILY learn Spin in
a day or so. If you are not an experienced programmer in general then you·might as well
learn Spin and get good at IT as opposed to starting with C anyway.....it would REALLY
behoove you to do so.

If you are already a C programmer then by all means go ahead with a C flavor for the
Propeller....but it is going to take you just as much time to learn·the particular
flavor of C and what you have to do to make it work for the Propeller as it would take
you to learn Spin.....assuming you are able to learn a simple language easily.


This whole language debate thing reminds me of when I took my·wife (Bostonian)
to London.·One day the Porter spoke to her and asked her a question. She looked at me
with bewilderment in her eyes and asked me what was the guy saying. I had not paid
attention to the guy and thought that he may have spoken to her in some foreign accent
that she could not understand.

So I asked him to repeat. To my amazement he was an Englishman who spoke English with
a London accent (not cockney just London English). My Bostonian wife had never been outside
the North and South Eastern region of the USA and thus could not comprehend an Englishman
speaking·perfectly good English with a London accent.

She truly could not understand a word he said. As far as she was concerned he could have
been speaking German. To make her get used to the accent I bough for her Monty Python
VHS tapes, but unfortunately she just did not appreciate the humor or the accent.

This happened many many years ago (too many) and I still till today think about it whenever
any kind of language debate (human or computer) is raised.


Versatility is the name of the game when it comes to programming in general and with
microcontrollers in particular. BE VERSATILE......LEARN MORE ...... EXPOSE YOURSELF to more
than your "native tongue"........SPIN is a pleasure to learn and use (I love it) and besides being
FREE it is also the language of the Propeller. If you want to use the Propeller most efficiently
you really ought to program it in Spin and/or PASM....


Regards

Sam

·

waltc
07-04-2009, 01:46 AM
If you're going to code for more micros than the Prop you need to learn C. C is the defacto HLL for micros from AVR to Zilog.

SPIN OTOH is a one of kind interpretive language tied to a single controller.

That said, I wouldn't try learning C on a micro. I'd get a copy of Turbo C and train on that for at least a month to get the basics of the language down. Then pick up a book on embedded C programming(check Amazon).

Nick Mueller
07-04-2009, 02:11 AM
> That said, I wouldn't try learning C on a micro.

Hmmm ... why not? As soon as you have a serial connection working, you have won! Brings back that warm console-feeling.

Obviously, there are many ways to look at the SPIN/C/$Language-controversy.
For an hobbyist (unexperienced, or almost unexperienced with other µC): SPIN
For an experienced with a bunch of µC on his background and with C-experience: Try SPIN for a week or so, then decide by yourself
For an professional who needs to make his things done and who has a pile of tested and profen libraries: C

But however you decide, have a look at the Asm. Especially for an experienced one, this is a completely freshening way to do things. Very interesting and worth the time spent learning.


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

localroger
07-04-2009, 02:26 AM
I have to side with Mike Green on this; although I dislike C, if you learn Spin first and you then need to learn C you will learn it very quickly, and further you will know it better than people who started with a modern C on the PC with all kinds of fancy aids, debugging tools, and compiler warnings.

The things Spin lacks that C "has" (hi jazzed!) are also largely lacking in dialects of C which are targeted at platforms like the Propeller. The things that are just plain different mostly have a 1:1 correspondence with something else in C.

The thing I like least about C, its stream of character syntax which makes C obfuscation contests possible, is there because C was designed to not only run on a PDP-11 but to compile on one too. Now that that limitation no longer exists we still have to put up with the curly bracket syntax which makes every conditional and control block structure end with the same character, so that unless you indent very carefully it is almost impossible to tell which of these --> }}}}} is the one that terminates the third level FOR loop.

I would further say that if you want to learn C, learn it on something like the Prop or Arduino, not on the PC because if you learn it in an environment with an advanced IDE, debugger, and all kinds of fancy helpful tools, you will be lost when you try to use it on a more limited platform. C became popular because it is so close to (and therefore nearly as powerful as) assembly language, but if your C dialect hides all the assembly level ugliness from you then you aren't really learning C, you're learning Javascript with exceptions.

If you seriously want to use the Prop, you should learn Spin and pasm no matter what, because there are things you can do in Spin and pasm you simply cannot do in any of the available C dialects. C that compiles to the LMM is going to be much more wasteful of Hub RAM than Spin and slower than pasm; C that compiles to pasm is going to be much more memory wasteful than actual pasm, which is a big deal in 512-word cogland, and C that compiles to byte code with an interpreter is Spin with different syntax and probably less functionality, since the Spin interpreter is very finely tuned to do as much as possible while fitting in a cog.

Incidentally, it is worth mentioning that the Spin interpreter does a bit more optimization than some people might realize. You're taught in the tutorial to use the postfix operator to set a bit like this:

myvar~

But this is a lot more readable, and generates exactly the same object code:

myvar := true

Spin object code is probably closer to FORTH than anything else and I wonder if anyone has tried using the Spin interpreter that way.

heater
07-04-2009, 02:26 AM
These language debates are always overblown.
If your a professional or experienced programmer you should be able to pick up almost any "normal" block structured language from ALGOL upwards with out a sweat.
If you are a beginner and have settled on a Prop then for gods sake save yourself a lot of pain and use Spin. That combination is one of the most straightforward programming systems to get into ever. Embedded or not.

If you really have a bucket of C code already that you want to run on the Prop, shell out for the ImageCraft compiler or try Catalina. Be aware, that bucket of code may not fit in the limited space of the Prop and will not have the speed of say an AVR compilation.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Post Edited (heater) : 7/3/2009 7:38:56 PM GMT

Bill Henning
07-04-2009, 02:30 AM
I totally agree with you.


heater said...
These language debates are always overblown.
If your a professional or experienced programmer you should be able to pick up almost any "normal" block structured language from ALGOL upwards with out a sweat.
If you are a beginner and have settled on a Prop then for gods sake save yourself a lot of pain and use Spin. That combination is one of the most straightforward programming to get into systems ever. Embedded or not.

If you really have a bucket of C code already that you want to run on the Prop, shell out for the ImageCraft compiler or try Catalina. Be aware, that bucket of code may not fit in the limited space of the Prop and will not have the speed of say an AVR compilation.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com (http://www.mikronauts.com) - my site my 6.250MHz custom Crystals for running Propellers at 100MHz (http://mikronauts.com/products/mikronauts-625mhz-crystal/)
Las (http://mikronauts.com/products/las-largos-lmm-assembler/) - Large model assembler for the Propeller Largos (http://mikronauts.com/products/largos/) - a feature full nano operating system for the Propeller
Please use mikronauts _at_ gmail _dot_ com to contact me off-forum, my PM is almost totally full

localroger
07-04-2009, 02:31 AM
Oh, and what Sam Mishal said. I don't like C very much but I do know how to use it, and there are times when it is the only solution.

heater
07-04-2009, 02:35 AM
I love this, we can have a white-space vs braces debate as well:)

localroger: "so that unless you indent very carefully it is almost impossible to tell which of these --> }}}}} is the one that terminates the third level FOR loop."

I might say for Spin:

"so that unless you indent very carefully it is almost impossible to tell which block is the one that a particular statement belongs in"

That is, when a statement accidentally get shifted out of place I have a hell of a time figuring out, again, in which block it originally belonged.

Try cut and pasting some code snippets from this forum into the Spin tool and you'll see what I mean. Drives me nuts:)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

jazzed
07-04-2009, 02:59 AM
I agree with heater's first post in this thread also. Though debates such as these are somewhat entertaining as well :)

Big quote snipped ....

{{{{{{{ BTW, Syntax highlighting is a wonderful thing :) }}}}}}}}

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


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)

Post Edited (jazzed) : 7/3/2009 9:07:37 PM GMT

localroger
07-04-2009, 03:36 AM
heater, you have a point. I think Spin is structured to teach you proper indenting habits, and forces a bit of pain on you to get used to it, but it would be easier to deal with with loop and structure terminating keywords. I occasionally get bit because of a longstanding habit of putting debug code out of indent order so it will be easier to find and obliterate when it isn't needed any more; you can't do that in Spin.

That said, how 'bout the difference between this:

}}}}}}

and this...

wend
end if
next
loop while c = 3
end if

The end of that FOR loop is a bit more obvious in Visual Basic.

heater
07-04-2009, 03:37 AM
heater said...
That combination is one of the most straightforward programming to get into systems ever.


Damn, did I really say that? I fixed that sentence twice and it is still gibberish. Now I can't fix it again as it's been quoted and quoted. Oh, and now I've quoted it again....

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Ale
07-04-2009, 03:43 AM
I'm the only one who thinks the indent of spin is similar to python's ?.

From someone who only likes assembler and sometimes C, learn Spin. It saves quite a bit of effort, it is compact, high level, and its speed can be increased using one of the few alternative interpreters around or write those time critical pieces in asm. The propeller is multi-core so think in parallel. Going back to monocres will be... hard!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit the home of pPropQL: propeller.wikispaces.com/pPropQL (http://propeller.wikispaces.com/pPropQL)
pPropQL020: propeller.wikispaces.com/pPropQL (http://propeller.wikispaces.com/pPropQL)
OMU for the pPropQL/020 propeller.wikispaces.com/OMU (http://propeller.wikispaces.com/OMU)

jazzed
07-04-2009, 03:46 AM
I'll unquote you heater :)

@localroger, Regarding debug code, I've fallen into a really bad habit lately much like using #if 0 ... #endif. Spin lets you combine comments and abusing that has become very attractive (the problem comes from using it too much). Just for amusement, consider this (no it's not spin, but you can do the same to temporarily block out code):



testloop
'{
mov mval, #CMD_WR32
wrlong mval, par
testwait1
rdlong mval, par wz
if_nz jmp #testwait1
'}
{
mov mval, #CMD_RD32
wrlong mval, par
testwait2
rdlong mval, par wz
if_nz jmp #testwait2
'}
jmp #testloop


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


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)

Kye
07-04-2009, 04:49 AM
...

I like the repeat (blah loop)

Much more flexible...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,

DogP
07-04-2009, 05:03 AM
From someone who absolutely loves C, and programs C on PCs and in embedded systems every day (TI DSPs, ARM7/9, dsPIC, Rabbit, etc) I'm very happy with Spin and Propeller's ASM. I wouldn't say Spin is close to C, since there's a lot of stuff missing, but if you're used to C, it's really easy to pick up Spin (just have the manual close for references). I guess it's like a simplified C, but the program flow still feels C-ish. It's really nice having a high level language so well matched to the hardware... a lot of times on a regular embedded system I have to use inline assembly or intrinsics to do operations specific to the hardware, so the flow of the program gets really ugly... in Spin, it flows just like any other code (like the bitwise reverse, rotate left/right, limit max/min, etc). And things like the dira, outa, ina, waitcnt, etc are really nice.

To be fair, I haven't tried any of the C compilers for the Propeller yet, but the software/library support for Spin is so good, I can't see trying a C compiler just to get some code portability, since I'll lose a lot of functionality from the contributions of the majority of users using Spin. I really just like the simplicity of the whole system... I can make it do pretty much anything I want, and I can write the code to do it very quickly. My biggest problem is the lack of native floating point (if even in the language). When I write code using the floating point libraries, it ends up looking REALLY ugly because of all the two argument functions (i.e. x*y*z is fMath.FMul(fMath.FMul(x,y),z)).

DogP

localroger
07-04-2009, 05:06 AM
@jazzed -- yah, you can really tie yourself in a knot with stuff like that. I kind of wish Spin didn't allow apostrophe comments but I know they did it to make the BASIC guys feel comfortable. It's fortunate that the PropTool highlights it for you to let you know you just commented out your whole program. I also find it just annoying when you go to create a block comment and you put in the opening { and YOUR ENTIRE PROGRAM goes comment color until you insert the closing }. But of course, how else could it work?

Nick Mueller
07-04-2009, 05:09 AM
Haha!
I like those discussions. Because they make it easier to judge one's knowledge. http://forums.parallax.com/images/smilies/smile.gif

I have the feeling, that at least 50% of those voting against C and pulling out this & that argument have no long-time experience with C. They even can't distinguish between IDE / OS-related libraries and the bare bone modern C language by itself with all its standard libraries. Read a book of P.J.Plauger ("The C standard library" and others) to get things straight and to understand what the language is. And don't be blinded by the fuzz and mess MS introduced. I personally no longer touch that crap. Done it too long.
But a nice C99 with an allmost complete set of libs is a charm to work with.


Oh, and should still be there somebody wanting to learn C and have a perfect (well almost, no ASCII table at the end) book on his shelf: "C in a nutshell" by Peter Prinz & Tony Crawford from O'Reilly. Damned good book!


Nick
PS: Don't forget: I once hated C!
And I earned my living with: Basic, Pascal, Modula, C, C++, ObjectiveC, Java, NewtonScrip, PL/SQL (oh my GOOOOOOD! that made my cry) and a few Assemblers.
Played around with 6502, 6809, 808X, SC/MP, 68000, PIC, AVR, Oberon, Eiffel, Occam, PL/1, my own languages, Fortran, SPIN ... WTH!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

Post Edited (Nick Mueller) : 7/3/2009 10:26:46 PM GMT

localroger
07-04-2009, 05:13 AM
@DogP -- I will admit that one thing most non-embedded C dialects have on Spin and .asm is native floating point math support; I just wish it also had equally good native string support, which is more important for most of what I do. And of course embedded C dialects are generally just as FP-lacking as Spin, for the same reason. Those routines cost a lot of HUB RAM and are also glacially slow (I've written at least tree FP libraries in my time for embedded systems that didn't come with their own so I have an idea). I think it is good to be made to consider very seriously whether to go to FP, though. Lots of what is done in FP could be done integer if you thought about it a little, and it would be a lot better. Sometimes FP is the only way, but sometimes it's just a lazy shortcut, and a lot of people aren't being taught that nowadays.

localroger
07-04-2009, 05:20 AM
@Nick -- I've used C in a fancy IDE which automatically highlights that stupid end bracket for you, and I've used it in DOS with an editor that was basically a port of EMACS to do embedded. I'm not aware of any variant of C that eliminates the }}}}}}} problem, nor of any language-general solution to the null terminated strings with no bound checking problem. The latter is not trivial; there is no version of VB regardless of what plugins you might lack that lets you puta 32 byte string in a 16 byte buffer, but every single version of C I've ever seen lets you do that. While that kind of efficiency is necessary when you are writing something like an operating system or a DES breaker, no language used for application development should ever allow such things.

Nick Mueller
07-04-2009, 05:27 AM
> but every single version of C I've ever seen lets ...

snprintf
RTFM! http://forums.parallax.com/images/smilies/wink.gif
You can gamble, but you don't have to.


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

DogP
07-04-2009, 05:36 AM
localroger: Yeah, most of the floating point stuff I do on the prop is complete laziness... I've got the spare CPU time and want a quick solution, so floating point it is. I've done way more than my share of fixed point math on other systems (video game homebrew, and my last project at work was converting a system from a floating pt c67x DSP to a fixed pt c64x DSP, as well as writing new code for the c64x), and while the performance improvement is great, why should I spend any time making it faster if it'll just idle in it's time saved? If later on I need the CPU time, I'll go back and convert them to fixed pt, but until then, IMO it's not a good use of my time.

But quite a few of the embedded compilers I've used still allow floating pt even if the system doesn't have FP hardware, just using software routines. While yes... you definitely need to evaluate whether or not you should be using floating point, I don't think my code readability should suffer greatly because of it.

DogP

SamMishal
07-04-2009, 05:54 AM
Nick Mueller said...
They even can't distinguish between IDE / OS-related libraries and the bare bone modern C language by itself with all its standard libraries. Read a book of P.J.Plauger ("The C standard library" and others) to get things straight and to understand what the language is. And don't be blinded by the fuzz and mess MS introduced. I personally no longer touch that crap. Done it too long.
But a nice C99 with an allmost complete set of libs is a charm to work with.

The myth of STANDARD C.................?????????????????????? Standard C is a JOKE..............
·
A program written in Standard C under MSC would not compile under Borland or under Watcom or under
GCC or under ............
·
Even a program written in MSC 4 would not compile under MSC 6 without a lot of changes and rewriting.
·
The myth that C is standard for different Microcontrollers is even more of a joke.
·
Each controller has registers and memory maps and and and and and that make it impossible to compile a program
written for one microcontroller to run on another without TONS of changes and customization and fiddling etc.
·
·
All the arguments of the advantages of portability are only applicable for COMPUTERS that are on the same level
of computability...... ie you may (perhaps) be able to port a standard C program written for a PC to the Mac or
a System 360 or a PDP 11.............HOWEVER........your program has to pretty much be a SIMPLE one that is
not doing much OS interaction or Graphics or Sound or Mouse or Keyboard or or or .................
·
The moment you start to write a program in C that does anything important with the hardware is the moment
you have kissed the STANDARD aspect goodbye......................


People who mention that SPIN lacks things like Structures are TOTALLY missing the point of what a
microcontroller is used for..................microcontrollers are not meant to be a replacement for a Computer
like the PC or Mac...................unless you·want to wind the clock back 40 years and remain content
to use the propeller as a supped up 6806 or Z80....................
·
The Propeller's power is in being a POWERFUL MULTITASKING, Parallel Processing MICRCONTROLLER................
not an Intel Duo replacement..............
·
·
Sam

heater
07-04-2009, 06:16 AM
Sam, I know what you mean but I do think " Standard C is a JOKE" maybe a bit over the top.

When you are working at the lowest levels, down at the hardware registers and dealing with interrupts etc, then obviously whatever language one uses one will find it very non-portable. That is a symptom of the vast array of hardware we have available, all different, not the language as such.

A little higher up and things start to look much better.

Example: In 1996 I helped a company rewrite an embedded system in C that was originally many 10s of thousands of lines of x86 assembler so that they could adopt a new Motorola 68000 based hardware platform and the PSOS operating system.

That code is still in use, now on Power PC and ARM based platforms and Linux. In the between it was used on PowerPC and VxWorks OS. During all that time it also ran on MSDOS and Windows such that it could be tested, debugged and used in system simulations.

I'm very sure I could get it compiled and running on the Prop using ICC or Catalina and putting a little effort into the lower level hardware abstraction layer.

So the standardization of C has been anything but a joke for me and many others in that situation.


It has been successfully compiled with all manner of C compilers.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Nick Mueller
07-04-2009, 06:18 AM
> The myth of STANDARD C.................?????????????????????? Standard C is a JOKE..............

A standard is definded. If vendor X claims to be standard, then he has to be. If he isn't he can't claim it. C99 is a well defined standard. And vendor X or Y can verify it against the test sites by Dinkumware (Plauger).


> A program written in Standard C under MSC would not compile under Borland or under Watcom or under
> GCC or under ............

Didn't I say to stay away from the MS-crap?
I once was employed for a company and developed under MS-C++. Later, I worked as a freelancer for them and did my work with Metrowerks C++ on a Mac at home. When things were running as wanted, I tested it with MS-C++. Guess what when things didn't work? MS did not adhere to the standard. Same for Watcom vs. MS. I was able to prove EVERY SINGLE issue with the standard (Plauger books, Stroustrup, $whatever).

> Even a program written in MSC 4 would not compile under MSC 6 without a lot of changes and rewriting.

Crap! I said MS-CRAP!

> Each controller has registers and memory maps and and and and and that make it impossible to compile a program
> written for one microcontroller to run on another without TONS of changes and customization and fiddling etc.

You've got to learn about abstraction and encapsulation to handle these tasks efficently. Hacking doesn't help! It only fixes. http://forums.parallax.com/images/smilies/wink.gif
Also, I have problems understanding why this sould be a problem of C compared to SPIN. Except you show me other platforms where SPIN is running on ...



Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

heater
07-04-2009, 06:18 AM
Sam, I like this part: "...wind the clock back 40 years and remain content to use the propeller as a supped up 6806 or Z80"

You may know I've wasted an inordinate amount of time on my hobby project of writing a z80 emulator for the Prop:)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

jazzed
07-04-2009, 06:26 AM
Sam. Gee, you don't have to yell :) Many programmers know how to get around the all problems you mention (except using the right CPU for the job :). Then again there are those who can barely keep themselves out of some kind of a spaghetti knot. The reason you trust your product only to those with adequate knowledge and experience is to avoid creating something that will eventually become a big PITA. A one semester C programming class is definitely not enough :) There many programmers who know so much though or their ego is so inflate, they need to have their heads forcefully extracted from certain body cavities. Most programmers are unfortunately heavy ladened with ego and various amounts of testosterone.

I wonder what the original poster thinks of all this :)

But heater it was your time to waste however you like http://forums.parallax.com/images/smilies/wink.gif

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


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)

CounterRotatingProps
07-04-2009, 06:58 AM
OK OK OK http://forums.parallax.com/images/smilies/freaked.gif http://forums.parallax.com/images/smilies/tongue.gif

These threads are always entertaining!· Hey, maybe we should have a new section in the forum, called: Language Bashing· :-P· Here's a new twist to this thread:

I'm really curious: how many languages do you all here *really* know?

The definition of "know" is: you are versed in, and fast enough in, the language that you could apply for a job as a professional programmer trainee using that language as the only one in your toolbox.·

Scenario: This job you would get based solely on your skill with that language, no other factors.· Before applying for the job, you'd have 2 weeks of say 2 hours to brush up, or about 30-40 hours of practice.· At your interview, your future employer would give you a test of 25 simple programming tasks, language applicability, and syntax. This test would take about 2 hours.· You'd have to score 80%·(20 out of 25)·(And, yes, I have both taken and given such tests.)

Think about it, be honest, and give only ONE number --- and when the line between a language and a derivative isn't clear, just count them as different.· (e.g. I counted VB and VBA as different.)


OS'es don't count, but scripting languages do.· You don't need to list the names of the languages, just give the number.·
And if your honest answer is 0 or 1, please don't be afraid to post that! It's one of the reasons we're here helping each other ---
After all, we all started at some point!

My answer is: 34
(I started programming in 1972, '73, or maybe '74? - and I love learning new languages :)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


Post Edited (CounterRotatingProps) : 7/4/2009 12:04:13 AM GMT

jazzed
07-04-2009, 07:06 AM
17 for me :)

Added: I've been messing with Verilog which would be my 18'th but have not "mastered it" although I have written a single HUB/COG Propeller (not cycle accurate) simulation with it that works :). Learning and knowing more than a dozen computer programming and scripting languages is not out of the question. Anything requires a few minutes of refresh time if you haven't looked at it in several months. It's not like a final essay exam with a pen and a blue book. It's all like riding a bicycle though. Once you know it, you don't have to learn it again beyond a quick and ready reference.

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


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)

Post Edited (jazzed) : 7/4/2009 3:46:16 AM GMT

CounterRotatingProps
07-04-2009, 07:07 AM
Cool, thanks Steve!

keep those answers coming!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Rayman
07-04-2009, 07:29 AM
I love C++ (with MFC, For my ally is the Microsoft, and a powerful ally it is. Life creates it, makes it grow. Its energy surrounds us and binds us)

But, you'd be a fool not to use Spin for some things, seeing as the interpreter is built into the ROM...

On the other hand, C is a million times more portable.

I truly believe that C compilers will be much more relavent for Prop 2, when we can port over MP3, JPG, and who knows what else...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
My Prop Info&Apps: ·http://www.rayslogic.com/propeller/propeller.htm

DogP
07-04-2009, 07:59 AM
Heh, I find it funny how the original poster was so vague with his post, and it exploded into what it has... it'd be nice if he'd come back and explain. There may be a perfectly good reason he needs to use C... if it's just the fact that he's afraid of Spin, IMO he should reconsider, or at least give Spin a try. On the other hand, if he has lots of well standardized/abstracted code that he understands well (probably wrote himself) which would port really easily, I can see that being a completely valid point. Another reason may be a boss says it must be in C (for a good or bad reason, but they're the boss). Or maybe the Prop is a stepping stone to a new product, which will need to be more powerful and outgrow the Prop in two years, so they don't want to have to rewrite the code when they go to a faster micro. As usual, there's many valid options, and if C was never one of them, quite a few people would have wasted their time making those C compilers.

DogP

CounterRotatingProps
07-04-2009, 08:09 AM
Oh well, at least I got one answer http://forums.parallax.com/images/smilies/wink.gif

> I wonder what the original poster thinks of all this :)

Maybe something like, 'what kind of a virtual landmine did I just step on?' :))

I'm smelling sand in the wind...

Sand trap ahead !

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Dr_Acula
07-04-2009, 08:23 AM
C on a propeller? Why not BDS C on heater's Z80 CP/M emulation?

Going off on a slight tangent here, I've had to put my propeller hobby on hold while I get my real-world wireless mesh working running on CP/M on a Z80. My entire water system on my property depends on this working and the existing system has just been destroyed in a small storm with uprooted trees, so I'm in a bit of a panic now as I've got only a few months to get it working. And I guess when there is a deadline, you fall back on the languages you are most comfortable with. I suppose those are the ones you 'really' know. For me, totally honestly, just 4.

I'm not going to include Spin yet. I'm still on the steep part of the learning curve. The very first problem I came across in spin was a long vertical line that started above the top of the screen and went below the bottom, and was part of an IF statement. Well, I just wanted a little branch to come off that with a new IF statement, but it wouldn't work. Sometimes it would jump to above the screen. Sometimes it would put a kink in the line so it wasn't straight anymore. Yes, the answer is to not put in 1 tab or 2 tabs or 1 space or 3 spaces but exactly two spaces. Not something I could find in the manual either. But I'm through the steep part of the curve and away flying now. And once I can turn a pump on wirelessly from 2km away and over a hill via multiple hops on solar powered repeater nodes (which is very close now), I'll have some spare time to come back to the triblade and the zicog as I think this is only a small step away from running C.

And so I have finally reached the conclusion *grin* - yes, you can run C on the Propeller.

CounterRotatingProps
07-04-2009, 08:32 AM
> For me, totally honestly, just 4.

That's great - and you probably know them well, right?· (Sorry to hear about the storm damage! Hurricane season here... oh oh)

>the conclusion *grin* -· yes, you can run C on the Propeller.

Ah, but what about C++ ?

... no no no, I didn't really ask that http://forums.parallax.com/images/smilies/nono.gif http://forums.parallax.com/images/smilies/jumpin.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

waltc
07-04-2009, 09:08 AM
If you're just a hobbyist and want to have a life outside of playing with micros, SPIN makes sense, its learning time isn't anywhere as bad C, especially when it comes to microcontrollers.

Personally I'm not all than enamored by SPIN but it does the job.

Heck you don't need C unless you're going program for other micros. But even then there are BASIC and Pascal compilers for those micros(PIC, AVR) that are popular with hobbyists.

SRLM
07-04-2009, 12:29 PM
@CRP

I'm comfortable with one language: C++ (a year of heavy classes at school helped...).

Nick Mueller
07-04-2009, 01:04 PM
If dialects are counting and scripting languages: about 15.
Mastered languages: None.
I'm not Stroustrup or any other one of that kind. And with any language, there's always something left to learn.

And if people have problems to match 10 levels of braces, their real problem is to get structure and divide a big task into smaller ones. 10 levels, that's braindead! It starts to get sick at 4 or 5.


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

Loopy Byteloose
07-04-2009, 01:57 PM
It all boils down to what Parallax can and cannot provide for free. While Parallax has been always commited to providing an excellent free IDE for their 3 chips, they seem to not be able to find anyone that wants to provide good support in C for free.

And so, either you are willing to buy C or you are willing to SPIN and PASM. Parallax has struggled to keep the cost of C down while having good quality. But that is just the way the world is.

It does seem that those that have gone the distance and learned C tend to not want to learn other languages. Yet in microcontrollers there really tends to be great benefits to learn to program at the machine language level because resources are so limited.

And so, I begin to wonder if the the C programer expects to use all the C libraries that are really beyond the resources of the microcontroller. There seems to be a bit of unreality creeping in to the equation.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Ain't gadetry a wonderful thing?

aka G. Herzog [ 黃鶴 ] in Taiwan

Nick Mueller
07-04-2009, 02:57 PM
> Yet in microcontrollers there really tends to be great benefits to learn to program at the machine language level because resources are so limited.

And the machine language is ASM. And I never voted against that.
In fact, I design in C. debug, see where the bottle-neck is (or know it in advance) and program that part in ASM.*) And for a reminder and clarity, each C-line is within the ASM, followed by the ASM-code.
And no, it isn't whise to drag in every library available for the smallest task. Some are simply too expensive (space-wise).

*)
And as a reminder:
Good algorithms and a well tuned data-flow is what makes speed. Not ASM, C, SPIN, ...


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

heater
07-04-2009, 04:22 PM
CounterRotatingProps: About 19 is the answer I came up with.

That's the number of distinct languages I have used in :
1. Paying professional work on major projects.
2. Non-trivial academic exercises.
3. Extensive hobby projects.

I could bump that up by counting more dialects or smaller experimental diversions to other languages.

I'd knock it down to almost zero for claiming mastery:)

Strange thing is I have had a long career designing and coding in all kinds of fields, embedded systems, process control, military communications, aerospace, CAD/CAM, on-line WEB stores etc. etc. In all of this rarely has anyone been overly concerned about my mastery of the language(s) that they are using or want to use on a given project. Never have I been subjected to such a test of language proficiency.

Rather jobs have been landed on the basis of long technical discussions at interview about the project in hand, getting into it's purpose, it's design, it's future direction etc.

I did tell one interviewer straight out that I have zero experience of the language and real-time OS in use at his company. "No worry" he says "You'll pick it up" and he offers me the contract as team leader for one year.

This is why I have said here that these language debates are "over blown".

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

CounterRotatingProps
07-05-2009, 01:10 AM
> ... these language debates are "over blown".

Yes, precisely one of the reasons I ask how many languages do we know. (And please keep the answers coming! This is actually very interesting IMO)

My experience has been that the more languages you have in your toolbox, the less you care about being an evangelist for any one in particular. Generally speaking that is. The exception is when a new language comes out that is really cool for whatever reasons, then there's good cause to be excited about it. E.g. PERL in the early days, PYTHON - even now, Ruby, and lately keep your eye out for "IO" a very very cool, easy to use message-based OOP (which is built in C/C++ ... I'm hoping some great soul ports it to the Propeller :)

http://www.iolanguage.com/

> Rather jobs have been landed on the basis of long technical discussions at interview about the project in hand,
> getting into it's purpose, it's design, it's future direction etc.

Exactly - the language is only a tool, not an end in itself (unless, of course, you are in a compiler-building shop :)

These language bashing threads are sort of silly. Think about it this way: what sense is there in fighting over "which is better, a screwdriver or a hammer?" If you read between the lines and analyse the points of discussion here, we're really talking about which is the more appropriate tool for the job. "A philips screwdriver or a slotted one?" hmmm, well "what kind of screws are we using?"...

So the question of "C" or "Spin" really should be "What MC are we using, and what tools and skills are the most common *currently*?"
If Propeller, Then (at least for now) SPIN handsdown. IF AVR, then C, etc. etc.

> rarely has anyone been overly concerned about my mastery of the language

Please recall that the def. of "known" in my query was not 'mastery' rather more 'entry-level trainee.' If I were to have said mastery, that would probably be defined as being able to write a compiler for that language into p-code from scratch. (If that were the case, I'd have to drop my 34 down to 0.5 :)

Loopy Byteloose> It does seem that those that have gone the distance and learned C tend to not want to learn other languages

Loopy, I'm not sure that's so true, if you consider the context I mention here to heater. Maybe that's the case initially, but many of us are forced to learn other languages, or at least be able to read them enough to maintain, interface to, or whatnot. Maybe it's like Steve (jazzed) said: "Most programmers are unfortunately heavy ladened with ego and various amounts of testosterone" --- ego and hormones are language neutral. :)

Cheers
Howard

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Nick Mueller
07-05-2009, 01:27 AM
> If I were to have said mastery, that would probably be defined as being able to write a compiler for that language into p-code
> from scratch. (If that were the case, I'd have to drop my 34 down to 0.5 :)

Does that count for an extra bonus? I did that!
Also poked around in the USCD-Pascal's p-machine. Squezed out about 0,3% more speed by using the additional 65SC02 op-codes. On my Apple ][. Hahaha! Those were the days.

Also wrote about 4..5 interpreters for my own or commercial languages. One of them built a parse-tree that wasn't destroyed, but was then used to execute the code. Three had an source-level-debugger with single-step, var-trace, breakpoints, ... They were written in Pascal, Modula-2, C and C++
And a parser (the code-generator was missing) for Newton-Script. But the project slowly died because the one wanting do make the garbage-collection didn't finish. He still has my book about garbage-collection.



Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

CounterRotatingProps
07-05-2009, 01:48 AM
> Does that count for an extra bonus? I did that!

LOL - and Viele Grüsse - Nick!

Great examples of hard-working code, I'd say :) Interesting ... is Modula-2 still in use these days? (I was recently surprised to find that SmallTalk is very much alive and well today.)

cheers and bis später!
- Howard

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Nick Mueller
07-05-2009, 03:54 AM
> is Modula-2 still in use these days?

Don't ask me!
Maybe for educational purposes? I wouldn't use it for real programming. It's a perfect language to learn programming, but for real live it is to restrictive. Compared to Pascal a big step forward. I worked with JPI-Modula and an other one. Don't remember. One of them had an akward editor (can't use a different one, because he made part of the parsing I guess) that was a PITA to use.

BTW:
Compiler-writing is no big sience. It was only obfuscated by some authors ("The Dragon Book", or by Rechenberg (IIRC) and later by all the table-driven compiler evangelists).
You need to draw a syntax-diagramm. If that works, all is coded the same way. The ultimate book is by N. Wirth "Compilerbau" (compiler construction; you know With, the father of Pascal and Modula). I think you can find it online now as PDF and in English. It's stone old and incedibly small but you don't need to know more. Should anybody be interested in that subject, this is *absolutely* the book to start with! I'll never ever give my copy away, and I have thrown away hundreds of programming-books!
For writing an compiler, I'd only use an OO-Language, makes live much easier. I'd even pick C++ for that. http://forums.parallax.com/images/smilies/smile.gif
Now try that in SPIN. http://forums.parallax.com/images/smilies/smile.gif (Sorry).


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

CounterRotatingProps
07-05-2009, 04:16 AM
<G>

perhaps the compiler writing isn't rocket-science, but you have to really understand *how* the language works under the hood to convert its syntax into something meaningful

remember this one:
(void far *) somePointer ; //?

- and tables have to be filled first :))

> Now try that in SPIN. (Sorry).

You are forgiven, but SinTax no more! ;-P

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Mike Green
07-05-2009, 04:22 AM
Now that we have a Spin compiler native to the Propeller, here's a link to a thread for a compiler-compiler that does run native on the Propeller and produces Spin code. It can compile itself (using a laptop to compile the Spin) and should work with Sphinx. This Meta2 compiler-compiler was used years ago to bootstrap a Pascal compiler on a small business computer (8-bit, 64K byte).

Hmmm ...

http://forums.parallax.com/showthread.php?p=692011

jazzed
07-05-2009, 04:24 AM
I designed a scripting language called "Alias" (ya, bad name) in 1999. The point of the language was to let hardware engineers write utilities and tests for new hardware bring-up/checkout and was included in the separate embedded diagnostic system for a line of network switches. Would have just used an existing language like TCL or PERL, but it would have made the image too big. The whole system was designed to run in less than 256KB. One of the nice features of Alias was any routine written by the user could automatically be converted to a C function with a "morph" command and quickly plugged in to the user interface.

I've thought about learning Ruby which look like a nice OOP language, but it seems a little bloated. I've used Python, but haven't bothered because the syntax looks a little odd ... to me at least. I took a few Pascal classes long ago, but I think it's rather awkward and don't count it in my list of languages.

As far as "mastered it" goes ... I used the phrase in quotes before for a reason. One does not need to know everything to "master" something. Having a solid working knowledge that can produce results and avoid pitfalls is my definition of mastering. A PhD "may" have a different definition. Socrates of course could make any master look like a fool (strong motivation for his eventual fate no less), but at least most of us learned some need for humility and avoiding hubris from him and his student :)

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


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)

CounterRotatingProps
07-05-2009, 04:31 AM
Steve,

both Ruby and Python are pieces of cake, and "IO" is even easier!

Right, Ruby's fat. But Spin shares Python's indentationism (is that a word??) Python can be made pretty skinny, but it has tons and tons (did I say tons) of librarys and modules. Both are Very Cool Languages. VCL is higher up than OOP http://forums.parallax.com/images/smilies/wink.gif

But look at IO:

Dog := Object clone
Dog bark := method("woof!" print)

>> Dog bark
woof!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

SamMishal
07-05-2009, 08:03 AM
CounterRotatingProps said...
> ... these language debates are "over blown".


My experience has been that the more languages you have in your toolbox, the less you care about being an evangelist for any one in particular.

Exactly - the language is only a tool, not an end in itself (unless, of course, you are in a compiler-building shop :)

These language bashing threads are sort of silly. Think about it this way: what sense is there in fighting over "which is better, a screwdriver or a hammer?" If you read between the lines and analyse the points of discussion here, we're really talking about which is the more appropriate tool for the job. "A philips screwdriver or a slotted one?" hmmm, well "what kind of screws are we using?"...

So the question of "C" or "Spin" really should be "What MC are we using, and what tools and skills are the most common *currently*?"
If Propeller, Then (at least for now) SPIN handsdown. IF AVR, then C, etc. etc.

EXACTLY...........
Thank goodness someone else thinks the way I do................(I used the screw driver metaphor in a previous post)

······ SPIN is the·perfect tool for the Propeller ...........I am not saying it is better or worse than C I am just
······ saying that it is the right tool for the propeller.............

·······By the way my number is 23.....but many are sooooo old they are not even in use anymore (anyone remembers Prolog or ModulaII????)

······ By the way I have been programming in C and C++ for 25 years now and I love them VERY MUCH. But like I have said repeatedly:

·······"Horses For courses"............and a good rider can ride whichever horse is given to him/her......the course might be a challenge
······ but the horse riding itself should not, regardless of the temperament of the horse.



····· Sam

SamMishal
07-05-2009, 08:09 AM
heater said...
Sam, I like this part: "...wind the clock back 40 years and remain content to use the propeller as a supped up 6806 or Z80"

You may know I've wasted an inordinate amount of time on my hobby project of writing a z80 emulator for the Prop:)


And I admire and applaud your work..............it is people like you that make me feel like I am not getting enough
hours in my day...........how can you do such stuff and still sleep eat and live the rest of your life ???????????????

I should have not had those children and also the wife while I am thinking about it.....

I am always amazed at what people on this forum have and are achieving..............

Sam
·

SamMishal
07-05-2009, 10:02 AM
Nick Mueller said...
For writing an compiler, I'd only use an OO-Language, makes live much easier. I'd even pick C++ for that. http://forums.parallax.com/images/smilies/smile.gif
Now try that in SPIN. http://forums.parallax.com/images/smilies/smile.gif (Sorry).


SPIN was never designed for that purpose and never claimed to be able to do that kind of
work......SPIN is a language for programming a microcontroller so that you can control
I/O projects.
·
It is not a data base, it is not a general purpose programming language. SPIN is the·
means to get a very powerful Parallel processing multitasking microcontroller to
do its job. It allows the user of this device to tell it how to do its job and it does that VERY
WELL............if you want to write compilers then SPIN is not the right tool.......
·
If you want to control a process and use the fabulous propeller to do it then the
best tool to accomplish this job is SPIN (+PASM in certain cases).
·
I think the problem is that some people are not able to distinguish between a microcontroller
and a computer. And the propeller being such a wonderful and powerful chip is partly to blame....
it is not helping since its capability and power is in a way blurring the delineation between the two............
·
·
·
Sam

heater
07-05-2009, 12:03 PM
Sam: "..how can you do such stuff.."

The z80 emulator is small fry compared to many other projects going on around here. A little here and a little there and it eventually gets done. Helps not to have a TV in the house. I'm sure a lot of people spend more time playing sudoku or filling in crossword puzzles than I do dinking with my little hardware/software hobby projects. The wife "understands" up to a point. Fortunately my son can get into it as well.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

RossH
07-05-2009, 03:29 PM
@all,

Wow - I stay away for a couple of days and come back to another language war - I love these things!

However, instead of contributing to this one, and rehashing all over again why I believe C is not only desirable, but also necessary on the Prop, I'll simply submit one argument:

Catalina C beta 5 now has a FAT32 file system

Did I write this file system myself? No - I couldn't possibly do so (I know very little about file systems, and am certainly not interested in exporing the internal workings of FAT32) - Instead, I simply found an ANSI C file system implementation on the internet (dosfs), and plugged it in. Adding file system support to Catalina didn't require a single source code change to dosfs - because it's also written in ANSI C.

Don't misunderstand me - I'm not knocking SPIN. And before anyone points this out, yes I know SPIN has an SD Card file system (albeit a very limited one which does not support FAT32) - that's all beside the point. which is ...

How many places can I go to find a complex algorithm implemented in SPIN when I need it?

Ross.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Catalina - a FREE C compiler for the Propeller - see Catalina (http://forums.parallax.com/showthread.php?p=795326)

Nick Mueller
07-05-2009, 04:08 PM
> People who mention that SPIN lacks things like Structures are TOTALLY missing the point of what a
> microcontroller is used for..................microcontrollers are not meant to be a replacement for a
> Computer like the PC or Mac

Then you completely missed the point about structures. COMPLETELY. And this for someone who says he's been programming for 35(?) years.
What has a structure to do with the size and complexity of a program? Or with the OS? Or the processor or µC?
It's a language-element for structuring and hiding information. And SPIN is completely missing it. Just have a look at *ANY* interface to PASM and you'll discover that either space is wasted by using 4 bytes for parameters where 1 or 2 bytes would be enough or how people mask, shift and patch bytes into longs.
In C, you'd only pass a structure with all the elements in the right size. And for example an 'assert(sizeof(theStructure) == 4)' helps avoiding slips during development.
Or as an other example:
In Mike Greens i2c/sdi - routines, he's using a control-block of 2 longs. You hust have to provide it to the routines. "Needs to be 2 longs", and if you slip to observe that, you might have lost and needlessly chase errors for hours. In C, just make a typedef of the structure and require that type as parameter. No chance to make it wrong. No extra code generated for typedef 'cause its a compile-time check.

I'm really astonished how an experienced programmer can make such a statement!

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

SamMishal
07-05-2009, 04:48 PM
Nick Mueller said...


In Mike Greens i2c/sdi - routines, he's using a control-block of 2 longs. You hust have to provide it to the routines. "Needs to be 2 longs", and if you slip to observe that, you might have lost and needlessly chase errors for hours. In C, just make a typedef of the structure and require that type as parameter. No chance to make it wrong. No extra code generated for typedef 'cause its a compile-time check.

So you are telling me C is not error prone...... Could one not overflow a pointer and end up chasing a bug for Months????? That is if he is lucky to
discover the error before shipping the product.....

If you are going to tell me that experienced programmers do not make such mistakes with C then the thousands of programmers
at Microsoft and IBM and and and are all lesser programmers than you allmighty Nick......

Sam




·

Nick Mueller
07-05-2009, 07:27 PM
> So you are telling me C is not error prone......

I said it once, I say it twice: There are tools, libraries and techniques to avoid -or at least reduce- them. Obviously, you've never heard of them. Or you wouldn't repeat that over and over again.
And then, in a next sentence you say that a language for a µC needs to offer lowest level access.
Now what you you really want?
A language that is always safe, one that can be safe, or one that doesn't even offer the lowest level of language-elements for checks/safetiness?

> Could one not overflow a pointer and end up chasing a bug for Months?????

Yes, you *can*, if you *want* to. But better: see above.


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

SamMishal
07-05-2009, 07:52 PM
Nick Mueller said...
> So you are telling me C is not error prone......

I said it once, I say it twice: There are tools, libraries and techniques to avoid -or at least reduce- them. Obviously, you've never heard of them. Or you wouldn't repeat that over and over again.
And then, in a next sentence you say that a language for a µC needs to offer lowest level access.
Now what you you really want?
A language that is always safe, one that can be safe, or one that doesn't even offer the lowest level of language-elements for checks/safetiness?

> Could one not overflow a pointer and end up chasing a bug for Months?????

Yes, you *can*, if you *want* to. But better: see above.


Nick


I am dismayed that Bill Gates has never hired you.....with your wisdom and abilities we won't
have to have an endless daily upgrade for Windows and the plethora of softwares that are plagued with
a myriad of errors.
·
Nick, I think you should go and reeducate the lowly programmers at all these inferior programming
houses that keep churning out error ridden software written in C and C++ the language that you
obviously have figured out how to make error free..............you will make millions..........
·
If only all those lowly programmers who obviously do not have your skill could join in this forum and
read your gems of wisdom about how to make C an error free language.

And oh thank you for enlightening me about the libraries in C ..... I have never heard of them before
since my programs are only a few hundreds of thousands of lines I never saw the need for libraries
or tools before......
·

Post Edited (SamMishal) : 7/5/2009 12:59:32 PM GMT

heater
07-05-2009, 08:04 PM
On the other hand, I've been happily running a Linux only PC for 10 years or more, most of the software I use has been written in C or C++ from the kernel to the web browser. Mostly it works just fine. Not sure where Bill Gate's crew went wrong.

I think it was RossH who came up with the answer to this debate. He mused over the idea of an Ada compiler for the Propeller!! That would give you all the type checking, range checking etc safety and security you could dream of.

Trouble is, it seemed to me, that not many programmers liked to work in that straight jacket for some reason.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Nick Mueller
07-05-2009, 08:59 PM
> Nick, I think you should go and reeducate the lowly programmers ...

They are called coding-cowboys, not programmers!
And if they are interested, they can reeducate themselves. By reading some good books, and not just MS-gazettes.
But as long as they are not interested and only live by kLOC, they keep on reporting over and over again from their little world that they think is the garden of Eden.


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

localroger
07-05-2009, 09:46 PM
Sam Mishal said...


I think the problem is that some people are not able to distinguish between a microcontroller

and a computer. And the propeller being such a wonderful and powerful chip is partly to blame....
it is not helping since its capability and power is in a way blurring the delineation between the two............

This is an interesting observation.· Whether the prop is a "computer" depends a lot on historical context.· The most popular computing platform in history only had 64K RAM and no standard mass storage.· I know people who ran businesses for years with Commodore 64's.· I/O and memory wise a C64 looks an awful lot like a Propeller Demo Board, except that it had only one 8-bit 2 MHz CPU instead of 8 80 MHz cores.· Considering all the things people did with C64's I think it would be quite a stretch, even today, to say that a C64 "isn't a computer."· It was after all more powerful and faster than the DEC PDP-11, the machine we have to blame for UNIX and C.

Another commonality between those computers and the prop is that much programming was real-time and involved cycle counting the instructions.· Anybody remember using the vertical interrupt to get the display to do impossible things?· You absolutely cannot do that kind of programming in anything other than assembly language, but I don't recall anybody suggesting that the C64 wasn't a real computer because such programming was so common.· In fact, I remember a long conversation with a big iron hacker about how similar techniques were useful in some of the stuff he was doing on mainframes, where tight management of the memory paging and·could come in useful.

The fact that we now all have machines sitting on our desktops and embedded in our TV sets and our cars and doorbells that could cheat a C64 at poker and talk it into voting Republican does not mean that those older platforms weren't or aren't useful, and much of the charm of the prop is that it invites us to go back to that mindset; with its unexpandable 32K and clock-rigid timing it's like the modern incarnation of a C64, only it costs $12 instead of $300 (and that in 1982).· It can also go into ridiculously low power modes when appropriate, another trick most "real computers" don't know.

But modern computing techniques can't be·used on limited platforms; all that wonderful abstraction costs RAM and CPU cycles which you inevitably need for your actual application.· If you want the quintessential high level language for this kind of programming, it's the "write-only" language FORTH.· And if you look under the hood, the first thing you notice about Spin is that its byte code is incredibly FORTH like.

So what I guess I'm getting around to is this:· Saying C is necessary for the prop is like saying Visual Basic is necessary for the C64.· Yes you could build something like that but mostly you wouldn't want to use it because you need the RAM and efficiency for your application.· (And before you say the comparison is ridiculous, look up GEOS.· That's right, there WAS a visual IDE for the C64, and it was quite popular; but it was used mostly for its bundled functions, and not many commercial applications used it.)· The situation with the prop is similar.· You could build something that general-purpose, and several people have taken stabs at it; but it keeps coming back to Spin and pasm because those are the tightest solutions for memory efficiency and speed, respectively.·

As for the prop needing C, I'd say that if you want to use the prop you will learn Spin and pasm or you'll find another chip; there's no shortage of other chips, most of which were actually designed with C in mind.··But if you want what the prop can do for the prop's price point, you'll learn Spin and pasm so you can use it.

Nick Mueller
07-05-2009, 10:08 PM
> Saying C is necessary for the prop is like saying Visual Basic is necessary for the C64.

This was a better shot, but still missed.
Problem: You mixed the language and its implementation. Like almost all posters in the thread did.

Think of an C-frontend that only tokenizes and downloads the result to the Prop for interpreting.
Win 1: Not fully interpreted, because the time-expensive part of tokenizing (that would have been to be made over and over and over again) is missing.
Win 2: All compile-time checking (and thats all the checking C offers) is done on the PC
Win 3: Code should be more compact then pure ASM

Or a C-compiler that generates code for a virtual machine (p-code, p-machine). Then you should be quite close to SPIN size-wise and speed-wise. And now if that compiler supports a "#pragma _native", you could wind out the time-critical parts in PASM.

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

localroger
07-05-2009, 10:35 PM
@Nick -- #pragma _native will not work on the prop because if you are compiling to byte code, the cog running the code is running the byte code interpreter, and you can't add more pasm and make a call to it; you must start a new cog and create a way to communicate to it what it's supposed to do and how to return any results to your mainline code.

There are really only a very limited number of ways a C compiler could work on the prop, just about all of which have been explored:

1. You can compile to byte code. Congratulations, you have invented a version of Spin which Parallax doesn't support.

2. You can compile to the LMM. This will be more memory bloaty than #1 and therefore not suitable for apps that are tight on memory (which will be nearly all of them), and considerably slower than #3 and therefore not as suitable for high speed I/O controls.

3. You can compile to pasm, in which case you are compiling to cog, not hub RAM limits and no native stack. You could probably create a version of C crippled enough to run in a cog but it would be extremely limited, nonstandard, and inferior to pasm for real work.

The most practical approach would probably be #1 compiling to Spin byte code, but using C syntax and adding some of the C struct stuff, conditional compilation, compiler checks and so on that Spin lacks. The Spin interpreter implements the stack, which you need for any recognizable implementation of C. But if you want to add functionality, you will need to write your own interpreter instead of using the native one (buh-bye, 4K of RAM) and any tradeoffs you make for added functionality will probably be paid for in slower execution.

heater
07-05-2009, 10:37 PM
Nick: Whilst you are right, time critical parts get done in PASM, no matter if you are working in Spin or C or whatever. I don't think we will ever see the #pragma_native on the Prop.

Reason is that no one is going to write a C compiler that generates native PASM, it just does not make sense, the COG space is too small and the instruction set just does not suit. Therefore the concept of in-line PASM in C (Or othr HLL) does not make a lot of sense. What should it do? Stop the current byte code interpreter on LMM kernel and load the COG with the in-line PASM, run that and then stop the COG and restart the interpreter/kernel at the appropriate point in the code. Or should it fire up a new COG to run the PASM and wait for the results? All or which demolishes the speed gains of any PASM fragments that are in-line.

No reason we could not have in-line LMM code or byte codes I guess but that's not giving us the full steam ahead speed we want either.

No, I think we will continue to see hand coded PASM tasks running in COGS and communicating with Spin/C/languageX through messages in HUB RAM.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

heater
07-05-2009, 10:42 PM
I wonder what happened to markuster and if any of this rambling debate here helped him?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

Nick Mueller
07-05-2009, 10:52 PM
> @Nick -- #pragma _native will not work on the prop because if you are compiling to byte code,

Sorry, you are right! I thought about generating code for LMM (or such) when I wrote that.
I'm aware of cog and hub and such. http://forums.parallax.com/images/smilies/wink.gif

Edit:
And no, I do not think it makes sense to generate code to run completely in one COG from a high-level language. Thats where ASM shines. Interfacing that to any language is not complicated when you pick that scheme with an communication area.

Edit 2:
What I like so much about the Propeller are the 8 cogs. One is running a master/scheduler/supervisor/arbiter in an high-level language, and the rest is busyly doing the hard work. Either in ASM or in some cases in a high-level language.
Its a waste of resources to let run only one cog doing a high level-program, while the rest is sitting there doing nothing. Propeller is such a wonderful parallel-processing world.
When I was younger, I couldn't afford to buy some Transputer-boards for playing around. Just had the money for the book about Occam. http://forums.parallax.com/images/smilies/shakehead.gif

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

Post Edited (Nick Mueller) : 7/5/2009 4:13:07 PM GMT

Sapieha
07-05-2009, 10:53 PM
Hi heater.

I guess He understood that it is not necessary to have "C" language to program Propeller.

In my opinion no matter what language is used only at that language does this job.
And as You said PASM in first place SPIN in most casses and other languages if them can fully suport PROPELLER's unique architecture.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nothing is impossible, there are only different degrees of difficulty.
For every stupid question there is at least one intelligent answer.
Don't guess - ask instead.
If you don't ask you won't know.
If your gonna construct something, make it·as simple as·possible yet as versatile as posible.


Sapieha

Post Edited (Sapieha) : 7/5/2009 4:24:38 PM GMT

SamMishal
07-06-2009, 02:33 AM
Sapieha said...
Hi heater.

I guess He understood that it is not necessary to have "C" language to program Propeller.

In my opinion no matter what language is used only at that language does this job.
And as You said PASM in first place SPIN in most casses and other languages if them can fully suport PROPELLER's unique architecture.


Ah.....but is he put off by the fact that PASM does not have structures and libraries of tools that Nick has
imagined would stop him from making errors????

Also PASM not having #pragma_native and other directives is such a bummer that Markuster must be lamenting all his
dashed hopes·for pogramming the Propeller to be an $8 replacement for Linux and Windows machines and perhaps
even the System 360......

But I am sure SUPER NICK would find a way to overcome these microcontroller limitations just like he found
a way of making C error free............. I am Looking forward to the day that Mighty Nick comes out with the next
version of Linux that runs on the Propeller.....


Sam



·

Nick Mueller
07-06-2009, 02:44 AM
> just like he found a way of making C error free

Is it that what you tell your boss when your programs crash "Hey boss, not my fault! C is not error free!".
Your arguments are getting more and more funny.
First you said, that structures are not for µC, but only for computers. Then it was, that you *can* have overrunning pointers and now it's the **language** that is not error-free.

Do you work at MS? http://forums.parallax.com/images/smilies/wink.gif


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

SamMishal
07-06-2009, 02:47 AM
localroger said...

As for the prop needing C, I'd say that if you want to use the prop you will learn Spin and pasm or you'll find another chip; there's no shortage of other chips, most of which were actually designed with C in mind.··But if you want what the prop can do for the prop's price point, you'll learn Spin and pasm so you can use it.

Absolutely.................................that is all I am trying to say…………
·
and us "coding-cowboys" are able to learn other languages and can live with the fact that we
need to read the manual so that we reduce errors without resorting to libraries and tools
that are in themselves full of errors since they were programmed by other coding-cowboys.
·
Yeehaa.......Rolling Rolling Rolling........(I am sure 90% of people on this forum do not know what this refers to).
·
·
Sam
·

Nick Mueller
07-06-2009, 03:00 AM
> and us "coding-cowboys" are able to learn other languages and can live with the fact that
> we need to read the manual so that we reduce errors without resorting to libraries and tools
> that are in themselves full of errors since they were programmed by other coding-cowboys.

Ah! Now I understand your point. You aren't actually programming anything. You just think about possibly programming. Maybe.
Because there could be an error -no, there **MUST** be an error in SPIN. So ASM is the one and only language even for complex programs.
But wait ... what about the errors in PASM?
You'd better stay away from computers, they are full of tons and tons of errors.

Blues brothers!

Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO (http://www.yadro.de)

CounterRotatingProps
07-06-2009, 03:03 AM
> Yeehaa.......Rolling Rolling Rolling

Sam and Nick: the way you're bashing each other, I'll bet you both will soon have " Raw Hides "

<rimshot>

http://forums.parallax.com/images/smilies/wink.gif

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

SamMishal
07-06-2009, 03:13 AM
CounterRotatingProps said...
> Yeehaa.......Rolling Rolling Rolling

Sam and Nick: the way you're bashing each other, I'll bet you both will soon have " Raw Hides "

<rimshot>

http://forums.parallax.com/images/smilies/wink.gif


VERY FUNNY......well put...... hahahahaha

Sam
·

heater
07-06-2009, 05:44 AM
Stop it you guys. This is getting silly.

What we are talking about, at the bottom line, is arranging a bunch of transistors to be on or off such that the circuit they sit in does what we want. If you get what you (or your boss/customer) wants then you win if not you lose.

How you do that is up to you. You can do it with toggle switches, you can be sophisticated and use tools to do it in hex, or asm, or C, or ADA or whatever you like. The choice is yours.

All those sophisticated tools are just a figment of someone's imagination.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
For me, the past is not over yet.

jazzed
07-06-2009, 06:35 AM
markuster said...
Hi,


I want to buy the Propeller but I don't want to buy the C compiler.

I saw that the trial version is 45 days. After 45 days the the code is reduced to 2k.

But I would like to know if there is an other difference with the commercial edition.


Thanks, Mark.


Hi Mark,
The memory limit is one difference. Another difference is you get access to most of the ICC library source.
Richard ImageCraft might have more to add .... Best of luck.

Keep them doggies rollin' ... 60's TV uugh http://forums.parallax.com/images/smilies/cry.gif ... at least it was better than most of the news. http://forums.parallax.com/images/smilies/skull.gif

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


Propalyzer: Propeller PC Logic Analyzer (http://www.brouhaha.com/~sdenson/Propalyzer)
http://forums.parallax.com/showthread.php?p=788230 (http://forums.parallax.com/showthread.php?p=788230)