<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="font-size: 12px; margin: 0px; ">Hi Matt</div><div style="font-size: 12px; margin: 0px; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; ">Hope things are OK with you.</div><div style="font-size: 12px; margin: 0px; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; ">The Plumb (28/june version) software looks good and is working fine for my programs so far.</div><div style="font-size: 12px; margin: 0px; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; ">Seems to be problem with the Windows version (same as was happening with the&nbsp; MAc version) in that we get a syntax error when compiling programs that compile fine on the mac version.</div><div style="font-size: 12px; margin: 0px; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; ">Was trying to produce occam code for the ADC but have not had any success so far.</div><div style="font-size: 12px; margin: 0px; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; ">I started out trying your "Plumbing" PROCs but with no success.</div><div style="font-size: 12px; margin: 0px; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; ">I&nbsp; then tried making up an occam program using a similar arrangement I had used in C with the Arduino IDE.</div><div style="font-size: 12px; margin: 0px; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; ">Here it is :</div><div style="font-size: 12px; margin: 0px; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">-- raw adc using ATMEL registers:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">#INCLUDE "plumbing.module"</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">PROC main()</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; SEQ</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE admux ADMUX:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE adcsra ADCSRA:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE adcsrb ADCSRB:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE didr0 DIDR0:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE didr1 DIDR1:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE adcl ADCL:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE adch ADCH:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE ddrd DDRD:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; PLACED [1]BYTE portd PORTD:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; ">&nbsp;&nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; SEQ</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; admux[0] :=&nbsp; #40&nbsp; --ref is 5V, sel ch 0</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; adcsra[0] := #86 --Enable ADC, prescalor x 64</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; adcsrb[0] := #00 --not using auto-triggering&nbsp;</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; --didr0[0] :=&nbsp; #3F -- disable digital inputs.</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; --didr1[0]&nbsp; :=&nbsp; #03 -- likewise to 000 0011</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; ddrd[0]&nbsp; :=&nbsp; #FF -- portd all outputs.</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; adcl[0] := 0</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; adch[0] := 0</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; portd[0] :=&nbsp; #00 -- initialise to zero.</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; BYTE result:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; --[2]BYTE bytes RETYPES result:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; BOOL going :</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; WHILE TRUE</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; SEQ</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; going := TRUE</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; adcsra[0] := 1 &lt;&lt; ADSC -- start conversion. Tried 6 as well</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; WHILE going</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SEQ</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; IF</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ADSC &gt; 0</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SEQ</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; going := FALSE</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; ">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; result := adcl[0] &nbsp; &nbsp;</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; portd[0] := BYTE result</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TRUE</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; SKIP &nbsp; &nbsp;</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br class="webkit-block-placeholder"></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">:</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">I also tried your ports[REG] := #value as in ports[ADMUX] := #40</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">But did not work either (compiled OK).</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">Perhaps these registers have not yet been added to the compiler?</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; 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="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">You appear to be using the ATMEL register names for ports as portb, portd ext.</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">I know you said you were working on the SPI so perhaps I should try that first.&nbsp; I have a C program for the SPI that I can translate to occam and try it out.&nbsp; Is this available with Plumb version 20130628?</div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; min-height: 14px; "><br></div><div style="font-size: 12px; margin: 0px; font-family: 'Courier New'; ">Peter</div></body></html>