Propeller RAM
Beavis3215
Posts: 229
in Propeller 1
When running a SPIN program in cog 0, using a variable, is the RAM for the variable in cog 0 ram or hub RAM?
Comments
The SPIN intrepeter is running in COG 0, and it is running your program from HUB RAM.
Time sensitive could mean, "needs to go faster", or it can mean, "needs to happen now", or both!
What are you intending time sensitive to mean?
It may be the timing period is simply too short for SPIN to perform consistently on.
What you do is have the PASM look at HUB variables on a regular basis. The SPIN program writes and reads from those and handles non speed critical stuff, to keep it all easy.
One of those limits does not seem to make sense. On the slower end of things, SPIN should be fine.
Spin converts to Assembly which converts to machine language(More time) and
Assembly converts to machine language(less time)
Is this fairly accurate, or not?
SPIN is compiled into byte code, which is a small representation of your program, intended to make the most of the RAM. SPIN is interpreted, meaning SPIN runs as a PASM program, which then runs your program as compiled byte code.
Yes, assembly language ends up being machine language, native to the COGS in the Propeller.
From the main web page select Learn and go down to Propeller C. Simple IDE is on the right.
http://learn.parallax.com/
http://learn.parallax.com/propellerc
http://learn.parallax.com/node/640
IMHO you should be using PASM to do your timing control. Spin will not get you the timing results you require.
To send simple pulses out at specific times is simple and deterministic with PASM. ie the timing can be precisely repeated.
PASM can be simple if you are only sending out timing pulses. You can still use spin to perform calculations etc that are not timing specific. There will be plenty of help here on the forums to get you going with pasm.
If you look at the PASM instruction summary you will find almost all instructions are similar - they have a source and destination which provide two inputs to the instruction, and the result is written to the destination, replacing its original value.
Easier than Spin and TRANSLATES directly to PASM
Propbasic doesn't get the attention it deserves here because, apparently, while JMP is cool, GOTO isn't LOL.
Any Idea in the code above why the waitcnt phenomena would occur in different speed groups? It reminds me of using a radio tuner looking for a carrier wave. I can see the wave, and harmonics of the wave,but nothing in the middle. CNT seems to have passed even in very slow speeds. I think it may be a limitation of spin, where the frequency of the raw data vs. the frequency of processing the data causes harmonic windows where waitcnt gets what it needs.
http://forums.parallax.com/discussion/149659/propbasic-how-to-use-propbasic-in-simpleide
http://forums.parallax.com/discussion/135678/download-latest-version-of-propbasic-for-viewport-here/p3
Language wars aside I think PASM on the Propeller is the easiest assembly language ever and as it is nicely integrated into the Spin language system it is very easy to use in general.
This has the great advantage that Spin/PASM is what the Prop was designed for and what has the most support in terms of people who know it and available objects to use when you need them.
To get minimal wait times using WAITCNT, you have to really minimize these calculations, probably use some kind of table for approximations. Even in PASM, it's better to use table lookup in this sort of circumstance. For multiplication by a constant, there are optimizations using shifts and adds.
I totally agree but it might be that the OP wants to simply "git-r-done" without having to jump through all kinds of learning hoops so I suggest what I find to be the easiest coding/fastest execution for the Prop.