caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Philippe Wang <philippe.wang@lip6.fr>
To: Goswin von Brederlow <goswin-v-b@web.de>
Cc: Philippe Wang <philippe.wang@lip6.fr>, caml-list@inria.fr
Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers
Date: Sat, 6 Nov 2010 20:19:18 +0100	[thread overview]
Message-ID: <2728CE5E-1335-4D6B-983D-305E6E5DA344@lip6.fr> (raw)
In-Reply-To: <87wroqpcny.fsf@frosties.localdomain>


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

> Philippe Wang <philippe.wang@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.Wang@lip6.fr
  http://www-apr.lip6.fr/~pwang/


  reply	other threads:[~2010-11-06 19:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr>
2010-11-04 21:44 ` Philippe Wang
2010-11-05 12:35   ` [Caml-list] " Daniel Bünzli
2010-11-05 14:26     ` Philippe Wang
2010-11-06 17:47   ` Goswin von Brederlow
2010-11-06 19:19     ` Philippe Wang [this message]
2010-11-11  1:09       ` ocamlclean : an OCaml bytecode cleaner (Was: (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers) Philippe Wang
2010-11-11  5:52         ` [Caml-list] " Julien Signoles
2010-11-11 11:57           ` Philippe Wang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2728CE5E-1335-4D6B-983D-305E6E5DA344@lip6.fr \
    --to=philippe.wang@lip6.fr \
    --cc=caml-list@inria.fr \
    --cc=goswin-v-b@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).