Version française
Home     About     Download     Resources     Contact us    
Browse thread
(Announce) "OCAPIC" : OCaml for PIC18 microcontrollers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Philippe Wang <philippe.wang@l...>
Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers

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/