From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id BBA57BC57 for ; Sat, 6 Nov 2010 20:19:33 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AusAAHtH1UyE4zwemWdsb2JhbACiCBUBAQIBCAsKBxEivFGFSASKVYMK X-IronPort-AV: E=Sophos;i="4.58,308,1286143200"; d="scan'208";a="77373650" Received: from osiris.lip6.fr ([132.227.60.30]) by mail4-smtp-sop.national.inria.fr with ESMTP; 06 Nov 2010 20:19:21 +0100 Received: from tibre.lip6.fr (tibre.lip6.fr [132.227.74.2]) by osiris.lip6.fr (8.14.4/lip6) with ESMTP id oA6JJJsL018147 ; Sat, 6 Nov 2010 20:19:19 +0100 (CET) X-pt: osiris.lip6.fr Received: from [127.0.0.1] (postepwang [132.227.83.184]) by tibre.lip6.fr (8.14.4/8.13.3) with ESMTP id oA6JJIdU008731; Sat, 6 Nov 2010 20:19:19 +0100 (MET) Subject: Re: [Caml-list] (Announce) "OCAPIC" : OCaml for PIC18 microcontrollers Mime-Version: 1.0 (Apple Message framework v1081) Content-Type: text/plain; charset=us-ascii From: Philippe Wang In-Reply-To: <87wroqpcny.fsf@frosties.localdomain> Date: Sat, 6 Nov 2010 20:19:18 +0100 Cc: Philippe Wang , caml-list@inria.fr Content-Transfer-Encoding: quoted-printable Message-Id: <2728CE5E-1335-4D6B-983D-305E6E5DA344@lip6.fr> References: <951AD91B-DA92-4F92-AE90-86A13DDB2357@lip6.fr> <87wroqpcny.fsf@frosties.localdomain> To: Goswin von Brederlow X-Mailer: Apple Mail (2.1081) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.5 (osiris.lip6.fr [132.227.60.30]); Sat, 06 Nov 2010 20:19:19 +0100 (CET) X-Scanned-By: MIMEDefang 2.68 on 132.227.60.30 X-Spam: no; 0.00; ocaml:01 ocaml:01 model:01 integers:01 mips:01 high-level:01 low-level:01 experimented:01 cheers:01 mfg:98 4620:98 wrote:01 ints:01 caml-list:01 writes:01 On Nov 6, 2010, at 18:47 GMT+01:00, Goswin von Brederlow wrote: > Philippe Wang writes: >=20 >> Dear all, >>=20 >> this is an announcement for "OCAPIC", a project which brings OCaml to >> programming PIC micro-controllers. >>=20 >> 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 >=20 > Doesn't the overhead of boxed structures as well as loosing a bit on > ints make that impractical given the extremly limited memory? >=20 > MfG > Goswin Thanks for the question. Let me try to give an (indirect) answer. OCAPIC has 16-1=3D15bit 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 =3D 64kiB; volatile memory =3D 3968B = ; EEPROM =3D 1KiB ; speed =3D 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).=20 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/