Propeller chip organization - NewB question
All,
I've read the manual several times and just when I think 'I got it', I don't 'got it'.
The way I understand it now is that I can have nine executable programs running at the same time - one in each cog and one in the Main Memory. I would be writing these programs in assembler and not Spin.
Is this correct?
I understand (?) that the cogs can only have access to Main Memory through the Hub but basically if I have, say four cogs, each watching a different I/O pin set to Input, I could, in effect, have four interrupts running at the same time, although they would only have access to the Main Memory when 'it's their turn'.
Is this correct?
Thanks for your help,
Dan
I've read the manual several times and just when I think 'I got it', I don't 'got it'.
The way I understand it now is that I can have nine executable programs running at the same time - one in each cog and one in the Main Memory. I would be writing these programs in assembler and not Spin.
Is this correct?
I understand (?) that the cogs can only have access to Main Memory through the Hub but basically if I have, say four cogs, each watching a different I/O pin set to Input, I could, in effect, have four interrupts running at the same time, although they would only have access to the Main Memory when 'it's their turn'.
Is this correct?
Thanks for your help,
Dan
Comments
The Propeller has 8 COGs, so you can have 8 parallel process runnning at one time.
Yes, all COGs have access to HUB RAM in a round robin fashion and each COG has access to I/O.
Please see the "Propeller Education Kit (pdf)". The PDF has a lot of great information and examples. Propeller Tool -> Help -> Propeller Education Kit (pdf).
As you can see, the others have answered you initial questions. Not much more to add except that there are no interrupts in the prop. If you are already used to interrupts, then initially it is a little harder to grasp but once you get used to a different way of thinking you'll be glad there are no interrupts. If you are not used to interrupts, then it is way easy without them.
Just to clarify a little further. Spin is actually a pasm program that fills cog ram and executes from there. It is really an interpreter and loads bytes from hub to execute the functions in cog. You do not need to worry about hub contention provided you understand each cog gets its own time slot to access the hub every 16 clocks in a round robbin method. So, one cog might write a byte/word/long to hub and another cog will not see that hub data (read it and see the change) until its next timeslot. All cogs can access all 32 I/O pins. If more than one cog writes to the same I/O pin they are "or"ed together internally so any one high will result in a high out and there is no contention problem - its a legal operation and can be useful.
The other thing is that there are a lot of objects in obex that include pasm to make various intelligent peripherals for the prop including serial objects, video drivers (TV and VGA), keyboard (PS2), etc. These may be used without understanding pasm.
Pasm is actually quite easy compared to other assembler code used in other processors because of the regular instruction set and small number of instructions. There is also no registers/accumulators as such, just the whole cog memory. This is because each instruction (most) access two locations for the data and stores the result in the second.
If there is something you dont understand, just ask. Please ensure your title reflects the main part of your question. If you post code please use the advanced section and place it in code tags to preserve the indentation, or post the whole zip file (ProtpTool will zip it all up for you).
I think from a previous post you were looking to monitor 8 pulse width (servo) channels, is that still the plan?
The good news is each cog has 2 counters, which could help count the width of the pulses for you, only taking 4 cogs total. There would be ways of reducing this further if you had to.
Yes. That is still the plan. I came to the same conclusion about two days ago. I figure to use both counters in each of four cogs to time two of the eight PWM channels and still have four cogs left over to watch the other analog and digital sensors, do some calculating and send out an ASCII string to the Propeller Servo Control Board.
I'll post some first-attempt assembler code for criticism.
Thanks to all for your replies,
Dan