PDA

View Full Version : Cogs, stack space, etc.,



Hugh
07-16-2009, 12:17 AM
Hi,

I have a couple of cogs monitoring switch positions and storing the position of the switches as global variables.

A main subroutine then accesses these values to take actions, etc.,

As I have built-up the main subroutine I have reached a point where the switches appear to be rapidly toggling on/off as the application progresses.

I've tried changing the stack-space allocated to the cogs monitoring the switches, but with no lock. Could the size of the main routine have reached the point where it has 'spilled over' into one of the switch-monitoring cogs, or could it be 'something else'?

Its got me scratching my head anyway.

Thanks
Hugh

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hugh - the thinking woman's Geoffrey Pyke.

Kye
07-16-2009, 12:19 AM
The main rountines stack space starts after all other allocated stack space.

More likely the main rountine is having problems with its stack or that you didn't give enough stack to the other cogs.

You code however is more likely the problem.

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

kwinn
07-16-2009, 12:34 AM
Hugh, I have posted a timer/switch sensing routine that does the same. The et-tester is a small test program that shifts data out to 3 '595's. Part of the data is the switch position. It only writes the data to hub ram when the switches change state. Hope it helps.

PS Please post or PM your routine to me so I can see how you approach it.

Hugh
07-16-2009, 02:17 AM
I think I had cogs 'overlapping'. When I removed the 'VGA_Drive' object I had added to assist with debugging the problem went away.

Another lesson learned!
Thanks

Hugh

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Hugh - the thinking woman's Geoffrey Pyke.