Re: [Caml-list] (Announce) OCAPIC : OCaml for PIC18 microcontrollers

2010-11-06 Thread Goswin von Brederlow
Philippe Wang philippe.w...@lip6.fr writes:

 Dear all,

 this is an announcement for OCAPIC, a project which brings OCaml to
 programming PIC micro-controllers.

 Some PIC18 series characteristics:
 - 8 bit architecture
 - low cost (a few US dollars), fairly spread in electronics world
 - very low volatile memory (a few bytes only, up to ~5000 bytes, depending on
 the model)
 - very low non-volatile memory (less than a KB up to 128 KB)
 - EEPROM : 0 to 1024 bytes

Doesn't the overhead of boxed structures as well as loosing a bit on
ints make that impractical given the extremly limited memory?

MfG
Goswin

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] (Announce) OCAPIC : OCaml for PIC18 microcontrollers

2010-11-06 Thread Philippe Wang

On Nov 6, 2010, at 18:47 GMT+01:00, Goswin von Brederlow wrote:

 Philippe Wang philippe.w...@lip6.fr writes:
 
 Dear all,
 
 this is an announcement for OCAPIC, a project which brings OCaml to
 programming PIC micro-controllers.
 
 Some PIC18 series characteristics:
 - 8 bit architecture
 - low cost (a few US dollars), fairly spread in electronics world
 - very low volatile memory (a few bytes only, up to ~5000 bytes, depending on
 the model)
 - very low non-volatile memory (less than a KB up to 128 KB)
 - EEPROM : 0 to 1024 bytes
 
 Doesn't the overhead of boxed structures as well as loosing a bit on
 ints make that impractical given the extremly limited memory?
 
 MfG
Goswin

Thanks for the question. Let me try to give an (indirect) answer.

OCAPIC has 16-1=15bit integers and 16bit blocks. And the overhead is quite 
acceptable to us.

A gobblet game [1] I.A. was implemented and tested. (The OCaml code is included 
in the distribution so anyone can check it out.)
The first version of this game was very hard to beat (for a human). Then a 
strategy was found (to beat the I.A.).  So some randomization was supplied to 
the I.A. to make it more interesting. Now the I.A. has become really very hard 
to beat.
(We used a PIC18F4620: flash memory = 64kiB; volatile memory = 3968B ; EEPROM = 
1KiB ; speed = 10 MIPS)

Between two moves, the I.A. may trigger the GC about ten times or more. 
However, the time between two moves is less than 2 seconds, and generally quite 
less than half a second (and in the beginning of the game it's hard to realize 
the time it takes).

Providing a GC to programming PIC microcontrollers is a tremendous gain 
comparing to manually manage everything (memory and computing). 
Providing a high-level language allows to implement algorithms that would be 
very hard or impossible to implement in ASM (or most low-level languages such 
as C or Basic).

We haven't yet experimented real-time constrained programming (e.g., ReactiveML 
might bring OCAPIC to a step further).

Now, maybe the direct answer to the question can be :
  programming PICs has been impractical to most people, now all readers of this 
list can potentially program them without much difficulties (and without paying 
a too high cost on performance efficiency).

:-)

[1] http://www.educationallearninggames.com/how-to-play-gobblet-game-rules.asp

Cheers,

--
Philippe Wang
  philippe.w...@lip6.fr
  http://www-apr.lip6.fr/~pwang/

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


[Caml-list] ocamlnet: event queues

2010-11-06 Thread Philippe Strauss

Hello,

still in my first cut at rpc, in my app I need to react on a file 
descriptor collectings logs for a child process, how do I transform


let esys = Unixqueue.standard_event_system () in
let server = Deconv_srv.Rpc_control.V1.create_server
~proc_connect: connect
~proc_set_input: set_input
~proc_set_deconvolution: set_deconvolution
(Rpc_server.Localhost 2345) Rpc.Tcp Rpc.Socket esys in
Unixqueue.run esys

to something where I can add an fd to the poll/select, and know which fd 
has triggered one run of the loop?
I did found Netsys_pollset.pollset.add fd browsing the doc, but writing 
a custom run() is another matter.



Thaaanks a lot.

___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs


Re: [Caml-list] ocamlnet: event queues

2010-11-06 Thread Jake Donham
On Sat, Nov 6, 2010 at 3:43 PM, Philippe Strauss phi...@philou.ch wrote:

 still in my first cut at rpc, in my app I need to react on a file
 descriptor collectings logs for a child process, how do I transform

let esys = Unixqueue.standard_event_system () in

   [...]

   Unixqueue.run esys

 to something where I can add an fd to the poll/select, and know which fd
 has triggered one run of the loop?


If I understand you correctly, you just want to watch an additional file
descriptor and react when it becomes readable. You can do that by adding the
fd to the event system with Unixqueue.add_resource, then attaching a handler
for when the fd becomes readable with Unixqueue.add_handler. See the docs at


http://projects.camlcity.org/projects/dl/ocamlnet-3.0.2/doc/html-main/Unixqueue.html

for more details.

Jake
___
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs