<div dir="ltr">Thank you, Carl. I missed that in a quick note last night. (James and I were working on getting his list membership sorted out.)<div><br></div><div style>James, another useful thing you might consider is drawing a dataflow diagram of your application, and thinking about how the data will flow from one parallel process to another. Some simple ones are in this paper:</div>
<div style><br></div><div style><a href="http://www.jadud.com/dl/pdf/jadud-simpson-jacobsen-sigcse2008.pdf">http://www.jadud.com/dl/pdf/jadud-simpson-jacobsen-sigcse2008.pdf</a><br></div><div style><br></div><div style>and a slightly more complex one is in this paper:</div>
<div style><br></div><div style><a href="http://www.jadud.com/dl/pdf/jacobsen-jadud-kilic-sampson-cpa2011.pdf">http://www.jadud.com/dl/pdf/jacobsen-jadud-kilic-sampson-cpa2011.pdf</a><br></div><div style><br></div><div style>
If someone on the list could point me at a more &quot;legoland&quot; resource, that would be great. I know there must be some material that will help James in thinking about how things flow from point A to point B in his app. </div>
<div style><br></div><div style>It feels a bit like you&#39;re wrestling with two things: the language, and the paradigm. I&#39;m thinking that we might be able to help you tease those apart a little bit.</div><div style>
<br></div><div style>Keep asking questions!</div><div style><br></div><div style>Cheers,</div><div style>Matt</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Dec 20, 2012 at 9:24 AM, Carl Ritson <span dir="ltr">&lt;<a href="mailto:C.G.Ritson@kent.ac.uk" target="_blank">C.G.Ritson@kent.ac.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi James,<br>
<br>
Because your PRI ALT is in a tight loop with a SKIP guard the system<br>
scheduler never gets a chance to run and no other processes can be run<br>
and read/drive the pins. At least that is what it looks like is<br>
happening to me.<br>
<br>
You have three option:<br>
1. Add a delay after digital.write (SprayLED, HIGH).<br>
2. Add a RESCHEDULE() after digital.write (SprayLED, HIGH).<br>
3. Use a timer guard to activate digital.write (SprayLED, HIGH) if<br>
CatIn! and CatOut! do not signal within a set time period.<br>
<br>
All of these will allow the scheduler to run the other processes.<br>
<br>
Cheers,<br>
<br>
Carl<br>
<br>
<br>
2012/12/20 James Brown &lt;<a href="mailto:james.brown4994@gmail.com">james.brown4994@gmail.com</a>&gt;:<br>
<div><div class="h5">&gt; Can anyone help me with PRI ALT.<br>
&gt;<br>
&gt; I am a beginner and have been trying to figure out how to use occam to build<br>
&gt; a simple cat deterrent.<br>
&gt;<br>
&gt; I have the following code.  It is not representative of what I want it to do<br>
&gt; eventually but rather to experiment with PRI ALT.<br>
&gt;<br>
&gt; I am expecting that a signal from CatOut or CatIn should drive ArmedLED low<br>
&gt; or high.  However it appears to ignore these signals.  I appears always to<br>
&gt; default to final TRUE &amp; SKIP condition.  I am stuck and I don&#39;t know how to<br>
&gt; debug it.  Any ideas gratefully received.<br>
&gt;<br>
&gt; #INCLUDE &quot;plumbing.module&quot;<br>
&gt;<br>
&gt; VAL OutPin IS 2 :<br>
&gt; VAL InPin IS 3 :<br>
&gt; VAL ArmedLED IS 12 :<br>
&gt; VAL SprayLED IS 13 :<br>
&gt;<br>
&gt; PROC blink.pin (CHAN SIGNAL out!)<br>
&gt;   WHILE TRUE<br>
&gt;     SEQ<br>
&gt;       delay (500)<br>
&gt;       out ! SIGNAL<br>
&gt; :<br>
&gt;<br>
&gt; PROC monitor.pir ()<br>
&gt;   SEQ<br>
&gt;     digital.mode (InPin, INPUT)<br>
&gt;     digital.mode (OutPin, INPUT)<br>
&gt;     digital.mode (ArmedLED, OUTPUT)<br>
&gt;     digital.mode (SprayLED, OUTPUT)<br>
&gt;     digital.write (ArmedLED, LOW)<br>
&gt;     digital.write (SprayLED, LOW)<br>
&gt;     CHAN SIGNAL CatIn, CatOut:<br>
&gt;     PAR<br>
&gt;       blink.pin (CatOut!)<br>
&gt;       delay (300)<br>
&gt;       blink.pin (CatIn!)<br>
&gt;       WHILE TRUE<br>
&gt;         PRI ALT<br>
&gt;           CatOut ? SIGNAL<br>
&gt;             digital.write (ArmedLED, LOW)<br>
&gt;           CatIn ? SIGNAL<br>
&gt;             digital.write (ArmedLED, HIGH)<br>
&gt;           TRUE &amp; SKIP<br>
&gt;             digital.write (SprayLED, HIGH)<br>
&gt; :<br>
&gt;<br>
&gt;<br>
</div></div>&gt; _______________________________________________<br>
&gt; users mailing list<br>
&gt; users@concurrency.cc<br>
&gt; <a href="http://lists.concurrency.cc/mailman/listinfo/users" target="_blank">http://lists.concurrency.cc/mailman/listinfo/users</a><br>
&gt;<br>
<br>
_______________________________________________<br>
users mailing list<br>
users@concurrency.cc<br>
<a href="http://lists.concurrency.cc/mailman/listinfo/users" target="_blank">http://lists.concurrency.cc/mailman/listinfo/users</a><br>
</blockquote></div><br></div>