<div dir="ltr">Hi Peter,<div><br></div><div style>All good to know. I&#39;ll take a poke, now that I own an Uno. I am curious as to why the Windows version would do anything differently, because so little is taking place on the local machine.</div>
<div style><br></div><div style>If it compiled OK, that means the register is defined. I&#39;ve moved the library to </div><div style><br></div><div style><a href="https://github.com/concurrency/plumbing">https://github.com/concurrency/plumbing</a><br>
</div><div style><br></div><div style>out of the main occam codebase, because the library really is a set of pure occam tools, and isn&#39;t tightly coupled to the (larger) tree. The defined registers are in</div><div style>
<br></div><div style><a href="https://github.com/concurrency/plumbing/blob/master/src/arch/m328p/iom328p.inc">https://github.com/concurrency/plumbing/blob/master/src/arch/m328p/iom328p.inc</a><br></div><div style><br></div>
<div style>which is automatically converted via Perl script from the C header file, so it should be 1) correct and 2) complete.</div><div style><br></div><div style>I haven&#39;t touched the SPI for a few days, but the nice thing is that there is no difference between a &quot;library&quot; and the code you write. So, anything you write can become a library simply by putting it in the compiler&#39;s include path.</div>
<div style><br></div><div style>Also, worth noting:</div><div style><br></div><div style>When you do an upload using the IDE, it uploads all of the occam (.occ) files in the directory that you&#39;re compiling from. So, if you have three files:</div>
<div style><br></div><div style>a.occ</div><div style>b.occ</div><div style>c.occ</div><div style><br></div><div style>all three will be uploaded when you compile a.occ. (Only .occ, .inc, and .module files are uploaded this way.) If &quot;a&quot; references &quot;b&quot; or &quot;c&quot; via #INCLUDE, it will work. This may be useful to you. It is *not* smart, however: it only grabs things within the directory of the file you&#39;re actively compiling.</div>
<div style><br></div><div style>More later, when I get a chance to poke things with a stick, and see what is up with the Windows side.</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 Tue, Jul 9, 2013 at 10:36 AM, Dr Peter D Minns <span dir="ltr">&lt;<a href="mailto:minns627@btinternet.com" target="_blank">minns627@btinternet.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div style="margin:0px;font-size:12px">Hi Matt</div><div style="margin:0px;font-size:12px;min-height:14px"><br></div><div style="margin:0px;font-size:12px">Hope things are OK with you.</div>
<div style="margin:0px;font-size:12px;min-height:14px"><br></div><div style="margin:0px;font-size:12px">The Plumb (28/june version) software looks good and is working fine for my programs so far.</div><div style="margin:0px;font-size:12px;min-height:14px">
<br></div><div style="margin:0px;font-size:12px">Seems to be problem with the Windows version (same as was happening with the  MAc version) in that we get a syntax error when compiling programs that compile fine on the mac version.</div>
<div style="margin:0px;font-size:12px;min-height:14px"><br></div><div style="margin:0px;font-size:12px">Was trying to produce occam code for the ADC but have not had any success so far.</div><div style="margin:0px;font-size:12px;min-height:14px">
<br></div><div style="margin:0px;font-size:12px">I started out trying your &quot;Plumbing&quot; PROCs but with no success.</div><div style="margin:0px;font-size:12px;min-height:14px"><br></div><div style="margin:0px;font-size:12px">
I  then tried making up an occam program using a similar arrangement I had used in C with the Arduino IDE.</div><div style="margin:0px;font-size:12px;min-height:14px"><br></div><div style="margin:0px;font-size:12px">Here it is :</div>
<div style="margin:0px;font-size:12px;min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">-- raw adc using ATMEL registers:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
#INCLUDE &quot;plumbing.module&quot;</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">PROC main()</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">  SEQ</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">    PLACED [1]BYTE admux ADMUX:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
    PLACED [1]BYTE adcsra ADCSRA:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">    PLACED [1]BYTE adcsrb ADCSRB:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
    PLACED [1]BYTE didr0 DIDR0:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">    PLACED [1]BYTE didr1 DIDR1:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">    PLACED [1]BYTE adcl ADCL:</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">    PLACED [1]BYTE adch ADCH:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">    PLACED [1]BYTE ddrd DDRD:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
    PLACED [1]BYTE portd PORTD:</div><p style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px">    <br></p><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">    SEQ</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      admux[0] :=  #40  --ref is 5V, sel ch 0</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      adcsra[0] := #86 --Enable ADC, prescalor x 64</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      adcsrb[0] := #00 --not using auto-triggering </div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      --didr0[0] :=  #3F -- disable digital inputs.</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      --didr1[0]  :=  #03 -- likewise to 000 0011</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      ddrd[0]  :=  #FF -- portd all outputs.</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      adcl[0] := 0</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      adch[0] := 0</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
      portd[0] :=  #00 -- initialise to zero.</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      BYTE result:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
      --[2]BYTE bytes RETYPES result:</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      BOOL going :</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">      WHILE TRUE</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">        SEQ</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">          going := TRUE</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
          adcsra[0] := 1 &lt;&lt; ADSC -- start conversion. Tried 6 as well</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">          WHILE going</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
            SEQ</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">              IF</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">                ADSC &gt; 0</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">                  SEQ</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">                    going := FALSE</div><p style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px">
                    <br></p><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">                    result := adcl[0]    </div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
                    portd[0] := BYTE result</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">                TRUE</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
                  SKIP    </div><p style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px">               <br></p><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">:</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">I also tried your ports[REG] := #value as in ports[ADMUX] := #40</div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">But did not work either (compiled OK).</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
Perhaps these registers have not yet been added to the compiler?</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
In C I could use pointers to addresses names, or ATMEL names but as far as I am aware there is no equivalent in occam.</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px"><br></div>
<div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">You appear to be using the ATMEL register names for ports as portb, portd ext.</div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px">
<br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">I know you said you were working on the SPI so perhaps I should try that first.  I have a C program for the SPI that I can translate to occam and try it out.  Is this available with Plumb version 20130628?</div>
<span class="HOEnZb"><font color="#888888"><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px">
<br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;;min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:&#39;Courier New&#39;">
Peter</div><div><br></div></font></span></div></blockquote></div><br></div>