<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-GB link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thanks. This is fascinating stuff. And the introduction of the timer guard has worked a treat!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> WHILE TRUE<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> SEQ<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> tim ? t<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> PRI ALT<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> CatOut ? SIGNAL<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> digital.write (ArmedLED, LOW)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> CatIn ? SIGNAL<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> digital.write (ArmedLED, HIGH)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> tim ? AFTER t PLUS 200<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> digital.write (SprayLED, HIGH)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>I completely agree and part of the problem is that I am diving in rather than systematically sitting down with the texts available and working through the theory carefully.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>In fact what I need to do is something like this, which if my thinking is right will do the same thing without the need for the PRI ALT and delay.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>CatIn Level</span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>à</span><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>Loop process to output In = TRUE </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>à</span><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> ^ | | <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> Interrupts </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>à</span><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> ALT </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>à</span><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>InOut channel<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> | v |<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'>CatOut Level </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>à</span><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'> Loop process to output In = FALSE </span><span style='font-size:11.0pt;font-family:Wingdings;color:#1F497D'>à</span><span style='font-size:11.0pt;font-family:"Courier New";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>So that is what I will try next.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Regards<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> jadudm@gmail.com [mailto:jadudm@gmail.com] <b>On Behalf Of </b>Matt Jadud<br><b>Sent:</b> 20 December 2012 17:46<br><b>To:</b> Carl Ritson<br><b>Cc:</b> james@barbet.co.uk; C.CC USERS<br><b>Subject:</b> Re: [C.CC USERS] Help needed with PRI ALT<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><div><p class=MsoNormal>Thank you, Carl. I missed that in a quick note last night. (James and I were working on getting his list membership sorted out.)<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>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:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><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><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>and a slightly more complex one is in this paper:<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal><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><o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>If someone on the list could point me at a more "legoland" 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. <o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>It feels a bit like you're wrestling with two things: the language, and the paradigm. I'm thinking that we might be able to help you tease those apart a little bit.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Keep asking questions!<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Cheers,<o:p></o:p></p></div><div><p class=MsoNormal>Matt<o:p></o:p></p></div></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On Thu, Dec 20, 2012 at 9:24 AM, Carl Ritson <<a href="mailto:C.G.Ritson@kent.ac.uk" target="_blank">C.G.Ritson@kent.ac.uk</a>> wrote:<o:p></o:p></p><p class=MsoNormal>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 <<a href="mailto:james.brown4994@gmail.com">james.brown4994@gmail.com</a>>:<o:p></o:p></p><div><div><p class=MsoNormal>> Can anyone help me with PRI ALT.<br>><br>> I am a beginner and have been trying to figure out how to use occam to build<br>> a simple cat deterrent.<br>><br>> I have the following code. It is not representative of what I want it to do<br>> eventually but rather to experiment with PRI ALT.<br>><br>> I am expecting that a signal from CatOut or CatIn should drive ArmedLED low<br>> or high. However it appears to ignore these signals. I appears always to<br>> default to final TRUE & SKIP condition. I am stuck and I don't know how to<br>> debug it. Any ideas gratefully received.<br>><br>> #INCLUDE "plumbing.module"<br>><br>> VAL OutPin IS 2 :<br>> VAL InPin IS 3 :<br>> VAL ArmedLED IS 12 :<br>> VAL SprayLED IS 13 :<br>><br>> PROC blink.pin (CHAN SIGNAL out!)<br>> WHILE TRUE<br>> SEQ<br>> delay (500)<br>> out ! SIGNAL<br>> :<br>><br>> PROC monitor.pir ()<br>> SEQ<br>> digital.mode (InPin, INPUT)<br>> digital.mode (OutPin, INPUT)<br>> digital.mode (ArmedLED, OUTPUT)<br>> digital.mode (SprayLED, OUTPUT)<br>> digital.write (ArmedLED, LOW)<br>> digital.write (SprayLED, LOW)<br>> CHAN SIGNAL CatIn, CatOut:<br>> PAR<br>> blink.pin (CatOut!)<br>> delay (300)<br>> blink.pin (CatIn!)<br>> WHILE TRUE<br>> PRI ALT<br>> CatOut ? SIGNAL<br>> digital.write (ArmedLED, LOW)<br>> CatIn ? SIGNAL<br>> digital.write (ArmedLED, HIGH)<br>> TRUE & SKIP<br>> digital.write (SprayLED, HIGH)<br>> :<br>><br>><o:p></o:p></p></div></div><p class=MsoNormal>> _______________________________________________<br>> users mailing list<br>> <a href="mailto:users@concurrency.cc">users@concurrency.cc</a><br>> <a href="http://lists.concurrency.cc/mailman/listinfo/users" target="_blank">http://lists.concurrency.cc/mailman/listinfo/users</a><br>><br><br>_______________________________________________<br>users mailing list<br><a href="mailto:users@concurrency.cc">users@concurrency.cc</a><br><a href="http://lists.concurrency.cc/mailman/listinfo/users" target="_blank">http://lists.concurrency.cc/mailman/listinfo/users</a><o:p></o:p></p></div><p class=MsoNormal><o:p> </o:p></p></div></div></body></html>