<div dir="ltr">Hi Peter,<div><br></div><div style>All good to know. I'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'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'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't touched the SPI for a few days, but the nice thing is that there is no difference between a "library" and the code you write. So, anything you write can become a library simply by putting it in the compiler'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'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 "a" references "b" or "c" 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'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"><<a href="mailto:minns627@btinternet.com" target="_blank">minns627@btinternet.com</a>></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 "Plumbing" 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:'Courier New'">-- raw adc using ATMEL registers:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
#INCLUDE "plumbing.module"</div><div style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:'Courier New'">PROC main()</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'"> SEQ</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> PLACED [1]BYTE admux ADMUX:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
PLACED [1]BYTE adcsra ADCSRA:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> PLACED [1]BYTE adcsrb ADCSRB:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
PLACED [1]BYTE didr0 DIDR0:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> PLACED [1]BYTE didr1 DIDR1:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> PLACED [1]BYTE adcl ADCL:</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'"> PLACED [1]BYTE adch ADCH:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> PLACED [1]BYTE ddrd DDRD:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
PLACED [1]BYTE portd PORTD:</div><p style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px"> <br></p><div style="margin:0px;font-size:12px;font-family:'Courier New'"> SEQ</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'"> admux[0] := #40 --ref is 5V, sel ch 0</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> adcsra[0] := #86 --Enable ADC, prescalor x 64</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'"> adcsrb[0] := #00 --not using auto-triggering </div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> --didr0[0] := #3F -- disable digital inputs.</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'"> --didr1[0] := #03 -- likewise to 000 0011</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> ddrd[0] := #FF -- portd all outputs.</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'"> adcl[0] := 0</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> adch[0] := 0</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
portd[0] := #00 -- initialise to zero.</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> BYTE result:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
--[2]BYTE bytes RETYPES result:</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> BOOL going :</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> WHILE TRUE</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'"> SEQ</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> going := TRUE</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
adcsra[0] := 1 << ADSC -- start conversion. Tried 6 as well</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> WHILE going</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
SEQ</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> IF</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> ADSC > 0</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'"> SEQ</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> going := FALSE</div><p style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px">
<br></p><div style="margin:0px;font-size:12px;font-family:'Courier New'"> result := adcl[0] </div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
portd[0] := BYTE result</div><div style="margin:0px;font-size:12px;font-family:'Courier New'"> TRUE</div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
SKIP </div><p style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px"> <br></p><div style="margin:0px;font-size:12px;font-family:'Courier New'">:</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:'Courier New'">I also tried your ports[REG] := #value as in ports[ADMUX] := #40</div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'">But did not work either (compiled OK).</div><div style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
Perhaps these registers have not yet been added to the compiler?</div><div style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
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:'Courier New';min-height:14px"><br></div>
<div style="margin:0px;font-size:12px;font-family:'Courier New'">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:'Courier New';min-height:14px">
<br></div><div style="margin:0px;font-size:12px;font-family:'Courier New'">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:'Courier New';min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px">
<br></div><div style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:'Courier New';min-height:14px"><br></div><div style="margin:0px;font-size:12px;font-family:'Courier New'">
Peter</div><div><br></div></font></span></div></blockquote></div><br></div>