[C.CC USERS] Occam-pi functions

Christian Jacobsen cljacobsen at gmail.com
Sun May 13 23:45:49 BST 2012


Hi José,

Most of our arduino source code have embedded occam-doc comments. I
have found an online copy of the documentation here:
http://www.rockalypse.org/courses/cs220f11/resources/occamdoc/index.html
You'll want to have a look at the printing module.

We also have a bunch of (unstructured, unfortunately) examples which
you can find here:
http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/trunk/tvm/arduino/occam/examples

In particular you might want to look at these programs:
http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/trunk/tvm/arduino/occam/examples/oscon/button-press.occ
http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/trunk/tvm/arduino/occam/examples/hello.occ
http://projects.cs.kent.ac.uk/projects/kroc/trac/browser/kroc/trunk/tvm/arduino/occam/examples/20100713_presentation/awesome.occ

The first of those examples (button-press.occ) seem like a decent (and
small) example of mixing plumbing and serial communications. You might
want to take note of the fact that the code that prints to the serial
port (lines 20-25) is a process that runs forever (WHILE TRUE on line
21). Each time through the loop, the following actions happen in
sequence (line 22): it waits for a signal that the button has been
pressed (line 23), once a signal has been received the process
increments the counter variable ch (line 24) and outputs the next
character in the alphabet on the serial port (line 25), and then goes
back to line 23 and waits for the signal again.

You might note that this program does not set the serial port up,
which you might want to do. Setting up the serial port is not strictly
necessary I think, since it is already set up by the runtime, but by
setting it up yourself you are sure of the state that the serial port
is in. Code for setting up the serial port would make your code look
something like this:
SEQ
  serial.setup(pin, baud)
  WHILE TRUE
    ... code to do stuff
    ... like wait for a signal perhaps
    serial.write.byte(pin, data)
    ... perhaps more code
    ... perhaps not

See if that helps, but feel free to ask more questions if you get stuck!

  Christian

ps. Matt's course page, which is where I found the arduino/plumbing
reference, has links to other occam-pi resources, such as the occam2.1
reference manual:
http://www.rockalypse.org/courses/cs220f11/to-do/n10-introducing-occam-pi/resources-www.html


On 11 May 2012 18:23, José Ruben Loibman <jloibman at gmail.com> wrote:
> Thank you. That is what I was looking for. But still need to find the
> communication functions, for serial communication through th Usb port.
> Anyone?
>
>
>
> -------- Original message --------
> Subject: Re: [C.CC USERS] Occam-pi functions
> From: David Gilmore <gilmorenator at gmail.com>
> To: José Ruben Loibman <jloibman at gmail.com>
> CC: users at concurrency.cc
>
>
> Have a look here:
>
> https://www.cs.kent.ac.uk/research/groups/plas/wiki/OccamPiReference
>
> Should answer your question :-)
>
> On May 10, 2012 12:58 PM, "José Ruben Loibman" <jloibman at gmail.com> wrote:
>>
>> Hello,
>>
>> I read the e-book "Plumbing for Arduino", really liked it. But I wonder if
>> there are any comparison functions as "if" in occam-pi language. I need a
>> function to read and write through seria communication by the usb port on
>> the Arduino. Can someone help me with those functions?
>>
>> _______________________________________________
>> users mailing list
>> users at concurrency.cc
>> http://www.concurrency.cc/mailman/listinfo/users
>>
>
> _______________________________________________
> users mailing list
> users at concurrency.cc
> http://www.concurrency.cc/mailman/listinfo/users
>



More information about the users mailing list