Cog shutdown?
If I load a module in a cog that is only a called·subroutine, does the cog continue to count phsa,b etc or does the cog shut down somehow?
·When I put:
·repeat
·· call subroutine· ' the counter works
··························'take the repeat out and only use the main to call the subroutine it doesn't work.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
·When I put:
·repeat
·· call subroutine· ' the counter works
··························'take the repeat out and only use the main to call the subroutine it doesn't work.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
Comments
When you 'call subroutine' is this a new cog?
What if you place a delay before calling your subroutine?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
The only way to start up a new cog is to use COGNEW or COGINIT, either directly or indirectly (by calling a subroutine that uses one of those statements). Not all objects start new cogs. Some of them are just objects (collections of subroutines and data).
When you start up a new cog, that cog has its own special registers including the counters. The original cog continues to run and its counters continue to do whatever they're set up to do. In multiprocessing parlance, the COGNEW or COGINIT acts as a fork operation.
It uses phsa and phsb to send count every second depending on freqa setting. When phsa rolls over phsb counts up one. The idea is to have a timer that keeps track of how long the chip is on without tieing up a cog.
·1. start timerb in cog 2
·2. Main program just prints value of phsb
Problem. If you remove the "repeat" in timerb it won't work but it should· if the counters in cog 2 are running.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
· Since the manual gives the impression that all cogs get there own ticks, then does this mean that a program with only 2 cogs running goes faster than one with 8 cogs running all else being equal?
Appreciate the help. Thanx
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
·Just a note for the next prop? Hmm. Thanx for the help, I think you've more than answered my questions.
Have a propping Day
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
Not really sure I need this much input or really want to get this deep. I spent 4 days trying to get the code to work.
I tried the idea of seting pin 18 hi when ctra rolled over and checking in main module if pin is hi. If hi add to time and turn off pin. Never got it to work. Problably something to do with switching dira's .
Here the idea: I guess this is what you had in mind.
Cog 0 runs
·cog 1 turn on light every second
cog 0 sees light and adds to timer and turns light off.
· I could get the light on, but never off.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.
If you don't supply these values, the compiler uses RCFAST as the default with CLKFREQ as 12MHz (which is approximate for this internal clock).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
······· "What do you mean, it doesn't have any tubes?"
······· "No such thing as a dumb question" unless it's on the internet
Technologically challenged individual, Please have pity.