Shop OBEX P1 Docs P2 Docs Learn Events
BS2 + C programming — Parallax Forums

BS2 + C programming

chemachema Posts: 14
edited 2005-03-15 09:34 in BASIC Stamp
Hi

Is it possible to program in "C" the basic stamp II·? Please, let me know-how...

What do I need ? I'd like to use Linux and Gnu C for programming the basic stamp

Help !!

Thank You

Comments

  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-03-12 22:36
    While it is theoretically possible, I don't really think anything exists or why you would specifically want to do it. It would be much better to use a C compiler to generate assembly code directly. The point of the Basic stamp is to simplify programming a microcontroller, C for the most part does the same thing, this is akin to thoroughly washing dishes by hand before placing it in the dishwasher.

    Peter Verkaik released a port of the smallC compiler for the SX in this thread: http://forums.parallax.com/showthread.php?p=521232·there are also commercially availible compilers, and I think there·is·a target file for the SX in one of the open source C compilers specially modified for microcontrollers (sorry I can't remember which one).
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-03-12 22:52
    It will take you an afternoon to learn to program the BASIC Stamp in its native language (PBASIC). It would take hundreds of man-hours to create a C-to-PBASIC translator ... you choose.· Our tokenizer only works with PBASIC source, and we do not reveal the source of our tokenizer (trade secrets) so there is no "official" documentation for creating the tokens that the BASIC Stamp understands.

    If you want to program in C then you might consider the SX.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA


    Post Edited (Jon Williams) : 3/12/2005 10:55:20 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-03-14 16:18
    Also, the BS2 uses a 'tokenized' form of PBasic which is downloaded into its EEPROM. The 'tokens' (each an integer, basically) are then used to select run-time routines from the run-time library burned into the PIC 16C54.

    What Jon was saying above is that theoretically you could write a 'C' compiler whose output would be the appropriate PBasic 'tokens' -- but why bother? You still won't be able to do any fancy 'C' constructs (typedef, struct, float, etc) unless they map directly into the PBasic language. You might as well learn the PBasic language (it's MUCH simpler than 'C').

    There do exist 'C' compilers for the PIC processor, and as Jon mentioned for the Ubicom SX processor, if you really want to go that direction.
  • chemachema Posts: 14
    edited 2005-03-14 22:00
    Hello,

    Paul, Jon and Allan, thank you for your comments and appreciations.

    Thanks
  • Adrian SchneiderAdrian Schneider Posts: 92
    edited 2005-03-15 07:41
    If you want to use PBasic on Linux there is a PBasic Compiler (based on the tokenizer Jon mentionned) available: see the 'Projects' Section in this forum
    Regards
    Adrian
  • chemachema Posts: 14
    edited 2005-03-15 09:34
    Thanks AdriaN !!· Did you try it ?
Sign In or Register to comment.