Shop OBEX P1 Docs P2 Docs Learn Events
Memory on Stamp — Parallax Forums

Memory on Stamp

ArchiverArchiver Posts: 46,084
edited 2003-05-20 19:58 in General Discussion
Does anyone know how the Stamp compiler handles CON statements like
LED CON 0?
It seems that there is no limitations on number of CON statements, or
is there?

And does anyone know how the PBASIC program is actually stored in
EEPROM? Does EE contain assembly language or ASCII code?

Much appreciated.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-05-20 17:46
    I never heard of 'con' statements like that ?????

    jim
    http://www.geocities.com/jimforkin2003/


    Original Message
    From: basicstampede [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=H8Js8Dma5O-Rgxt0dqjjmEBJwz8_fSIxyp6VZHw9pcqyOJBGHWF6yG7fCafVSOWLtNgvIIgqPC32ahQ6LQ]basicstampede@y...[/url
    Sent: Tuesday, May 20, 2003 12:05 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Memory on Stamp


    Does anyone know how the Stamp compiler handles CON statements like
    LED CON 0?
    It seems that there is no limitations on number of CON statements, or
    is there?

    And does anyone know how the PBASIC program is actually stored in
    EEPROM? Does EE contain assembly language or ASCII code?

    Much appreciated.


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-05-20 18:40
    Please feel free to use CON statements profusely in your program -- they do
    not cost program space (the compiler substitutes the constant value for the
    symbol just prior to the actual compilation process), will make your programs
    easier to read and often easier to maintain.

    Your PBASIC code is compiled to tokens [noparse][[/noparse]byte codes] for storage in the
    Stamp's EEPROM. The trick is that the tokens are variable-width so that we
    can squeeze the greatest number of tokens into the EEPROM possible.

    -- Jon Williams
    -- Parallax

    In a message dated 5/20/2003 11:06:55 AM Central Standard Time,
    basicstampede@y... writes:

    > Does anyone know how the Stamp compiler handles CON statements like
    > LED CON 0?
    > It seems that there is no limitations on number of CON statements, or
    > is there?
    >
    > And does anyone know how the PBASIC program is actually stored in
    > EEPROM? Does EE contain assembly language or ASCII code?



    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2003-05-20 19:58
    As answered earlier, the PBasic program is stored
    as 'tokens' in the EEPROM. What's a Token?

    PBasic is a 'p-compiled' language. This means
    the tokens of the language (HIGH, LOW, GOTO, GOSUB)
    are converted into a number 'Token'. This 'Token'
    is then downloaded to the EEPROM as part of the
    compilation process.

    When the program is 'run', the PBasic interpreter
    (firmware, on the BS2 PIC processor, proprietary
    Parallax code) reads the 'Tokens' from EEPROM,
    and based on the 'Token' calls subroutines in
    its interpreter to do the requested action.

    The benefits of this approach are you can program
    in a 'high-level' language (PBasic), you can
    test and debug easily, and the 'Tokens' take up
    less space in the EEPROM than expanded assembly
    code.


    --- In basicstamps@yahoogroups.com, "basicstampede"
    <basicstampede@y...> wrote:
    > Does anyone know how the Stamp compiler handles CON statements like
    > LED CON 0?
    > It seems that there is no limitations on number of CON statements,
    or
    > is there?
    >
    > And does anyone know how the PBASIC program is actually stored in
    > EEPROM? Does EE contain assembly language or ASCII code?
    >
    > Much appreciated.
Sign In or Register to comment.