[CCC DEV] Concerning commit 6894(ish)
Michael Pirrone-Brusse
pirronm at allegheny.edu
Tue Jul 20 00:02:43 BST 2010
Hey Fred,
My problem seems to be less whether I'm trying to make these
side-effects happen in a PROC or a FUNCTION, and more that I can't declare
the variable to be side-effected. I should have been more clear earlier, my
apologies.
The use-case I'm trying to get working looks like:
BYTE aByte:
SEQ
analogReference (INTERNAL)
aByte := analogRead (board.pin)
Where analogReference sets some global variable (ADC.REF), and the
FUNCTION analogRead uses that global variable as a configuration option. It
looks like a functional language here, because, again, I'm trying to make
these calls look as much like ardino.cc's C code as I can. It's gross.
The problem I'm not sure how to get around is that
when declaring ADC.REF outside of any PROC or FUNCTION blocks, the compiler
throws an error if I write "INITIAL INT ADC.REF ... "or just "INT ADC.REF
...". When I write "VAL INT ADC.REF ... " I get compiler errors (in both
FUNCTIONs and PROCs) telling me that I can't assign new values to ADC.REF.
It's my understanding that all of this is proper for Occam, as
VAL declares something as a constant, and global variables... aren't.
If you'd like to take a look at the relevant code, it's on lines 44 and
100-119 here:
http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/trunk/tvm/arduino/occam/include/wiring.module
Sorry for taking so long in explaining that... I'm really worried that
I'm wrong about half of what I've said, and there's a paragraph on some
webpage I've been oblivious to which will clear all of this up in two
minutes. I apologize if I'm being a waste of time.
Thanks, though, for taking the time to read,
-Drew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.concurrency.cc/pipermail/developers/attachments/20100719/2136870c/attachment.htm>
More information about the developers
mailing list