Shop OBEX P1 Docs P2 Docs Learn Events
Do 'comments get loaded into stamp eeprom? — Parallax Forums

Do 'comments get loaded into stamp eeprom?

Clock LoopClock Loop Posts: 2,069
edited 2005-11-21 15:15 in BASIC Stamp
Do 'comments get loaded into stamp eeprom, or are they cut out when you load them into the stamp?

I tried to search the forums for this answer, and the pbasic help file and couldn't find an answer.

I would hope that they DON'T??

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-20 01:41
    No. The program is compiled into tokens that are loaded into the EEPROM; comments only exist in your original source file and do not affect your program size, so comment away.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-11-20 02:16
    Heres another question along the same lines....

    Does it matter how one chooses to enter information?

    For example, using HEX, BIN or DECIMAL.

    SHIFTOUT Dpin, Clk, MSBFIRST, [noparse][[/noparse]8\8] <--- this example shifts out the number 8,
    in this situation, in binary thats 0000 1000

    Is there really any BETTER way to go? or is it just programmers desire?
    By better I mean for the compiler, EEPROM?

    By your previous answer, I would guess the answer is "its all the same to the compiler"
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-20 02:46
    Numeric formatting is for us humans and internally everything is represented in raw binary format. In my book the "better" way to go is the format that makes the code easiest to read and understand. For example:

    LEDs = %10100101

    is easier to visualize than

    LEDs = $A5

    or

    LEDs = 165

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2005-11-20 18:33
    And $A5 is easier to recognize as binary code than the decimal equivalent of 165.

    Save decimal for genuine arithmatic, use bits for information related to ON/OFF status of pins or status flags in a byte, and use general binary code for things like ASCII.

    If you have a good reason for each use in a particular context, they help you rather than hide problems.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "When all think alike, no one is thinking very much.' - Walter Lippmann (1889-1974)

    ······································································ Warm regards,····· G. Herzog [noparse][[/noparse]·黃鶴 ]·in Taiwan
  • StarManStarMan Posts: 306
    edited 2005-11-20 20:06
    I keep this link handy while i'm learning (which will be a long time,·I believe).

    http://ascii.cl/conversion.htm



    Chris I.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-21 02:11
    What's even easier is the calculator built in to Windows.· It has a view menu which you can switch to Scientific mode.· In that mode base conversion is as easy as a mouse click.· Even I use it.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-11-21 02:54
    Heres a bunch of HTML-JAVA tools, that includes a HEX-BIN-DEC converter among ALOT of other EE tools.

    http://forums.parallax.com/showthread.php?p=556244
  • Clock LoopClock Loop Posts: 2,069
    edited 2005-11-21 14:43
    IS there a quick way to 'COMMENT out ALOT of code, by highlighting the code you want EXCLUDED from the compile, and pressing a key combination or something?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-11-21 14:54
    Not to comment it out, but you could use the conditional compilation commands to effectively remove a section of code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-11-21 15:15
    For instance, I typically use the word "NeverDef" to be a symbol never defined. Then you can do:

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}

    ' #DEFINE NeverDef

    #IF NeverDef #THEN

    DEBUG "Hello"

    #ENDIF

    When you comment out the '#DEFINE' above, then NeverDef is never defined, and the stuff between the #IF and the #ENDIF are 'commented out'.

    I know, VB has this very nice 'comment out' button which will 'comment out' everything you've highlighted. The PBasic IDE doesn't have this.
Sign In or Register to comment.