P2 A Beginning
kg1
Posts: 164
This works ok:
Will not run?
Any suggestions please.
Kevin.
When editing this post I can see the file attached below. Prior to entering edit mode it had disappeared!
PUB MinimalSpin() REPEAT PINWRITE(63..56, GETRND()) 'Needs extra brackets WAITMS(100)This is a modification:
PUB MinimalSpin() REPEAT PINWRITE(63..56, GETRND()) WAITCT(2_000_000 + GETCT())This does not work:
PUB Toggle() | temp dira[60]~~ repeat temp := !outb[60] WAITCT(2_000_000 + GETCT())temp added to avoid error with !outb[60]
Will not run?
Any suggestions please.
Kevin.
When editing this post I can see the file attached below. Prior to entering edit mode it had disappeared!
txt
2K
Comments
temp := !outb[60]
...do this...
outb[60]!
Look in the Google Doc of the Spin2 documentation and review the Operators section. It's all in there.
Make it dirb, instead.
And remember that those registers only have bits that go up to 31, So when you say 60, that top bit is being ignored, making it really bit 28 of dirb/outb.
To use a bitfield we need a dot in front of the square brackets that is .[28]
Modified file attached.
The first file attached was not deleted. For me in FireFox it has disappeared. Lets hope the file below remains attached to this post!
Ah, yes, I forgot about the period that needs to go in front of the brackets.
Since I'm also using Firefox (under W 8.1/64) and I am able to see both, perhaps any "cached-alike" effect can be taking effect here.
As for Firefox options settings, I've forced it to wipe everything, acording to my settings, each time Firefox closes.
But there is a trick (eh eh eh, there is ealways one): I always; repeating to be clear, always use Ccleaner, after closing Firefox, or any other browser (I do it not very often; perhaps twice a day, or three times, maximum).
And you bet, there is an interesting symptom, that happens to show, not every time a Firefox session is closed, but very often indeed: Ccleaner complains that Firefox is still open, in the background, and asks me if I want it (Ccleaner) to close the unnoticeable session for me.
By inspecting with task manager, there is indeed a unclosed, ghost-alike session, under the hood, so I instruct Ccleaner to close it, and continue whith its cleanse/wipe task.
After Ccleaner does its job, I always re-start my system (seems paranoid, but, normally, just before lunch and dinner, and just one more, during the high-night-ours period, if I stay connected a "little more")
There are other possibilities, including intermediate caches, between your access point and the forum web server, but those are beyoud our arms reach...
Have I treated the parameter Pin 60 correctly?
Many thanks,
Kevin.
Have you used COGSPIN?
Kevin
There are no comments in this code, but this is a "traditional" SpinX object with start() and stop() methods. Since you could set count to something like POSX, there is a method that returns true if the blinker is running.
Edited
In @cgracey document he has:
'COGINIT(16, @IncPins, 0) will launch this program in a free cog
'COGINIT(32+16, @IncPins, 0) will launch this program in a free cog
but nothing about COGSPIN. COGINIT is for running asm and COGSPIN is for running spin2.
I do not understand why in one function he used 16 and in another 32+16. How do these relate to cognum?
I guess if one sets cognum in the range 0 to 7 then the function will run in that specific cog, if it is not in use.
If one wants any free cog auto select, then cognum should be set to ....
I will use your print object to check which values qualify.
Kevin.
Would it be better if the labels were:
COGEXEC
HUBEXEC
COGEXEC_NEW
HUBEXEC_NEW
COGEXEC_NEW_PAIR
HUBEXEC_NEW_PAIR
@cgracey Can you confirm, please? And I would go with the second set of labels.
I think these are better.
For those who wonder what I am about:
I believe that human beings may be categorized as word persons (say 60%) or arithmetic / logic persons (say 30%) and the balance a not so common mixture of both. Word persons generally love writing or receiving reports and rarely implement or build anything. Logic persons do not enjoy writing words and cannot see the point of writing long descriptive prose that describes what is fundamentally logical.
At secondary school I loved mathematics. My maths teacher was inclined to send me home rather than have me present in his classes. He never asked me how I knew so much. To me the answer was that I read the textbooks the night before class. In my third year the school was worried that I would not pass the external exams which required a 30% pass rate in English or fail all papers. Even though it was a government school they employed a teacher just to teach me English / grammar for a year. I passed English with 32%. Am I a word person or a logic person? The school had no idea that my much loved grandmother was killed, in daylight, by a drunk driver just 300 meters from the school. My school leaving testimonial was unusable.
If a dozen children rush into a room, perhaps not seen for a year, I would have great difficulty recalling their first names. At times I can go completely blank trying to remember even simple words. The best ideas come in a flash when I am not trying to think of a solution.
Regards,
Kevin.
Ey, that's me! Altough I am great at finding solutions for problems I'm not actually facing
Kevin