Shop OBEX P1 Docs P2 Docs Learn Events
Memory map — Parallax Forums

Memory map

tronsnavytronsnavy Posts: 70
edited 2009-07-25 03:16 in BASIC Stamp
Greetings from VA Beach,

In the manual "What's a Microcontroller?", I just fininshed Activity #3 in chapter 7.· I used the "write" command to store values from the photoresister (to address's 00-58 DEC, 00-3A HEX).· I then used the "read" command to display those same values in the debug terminal.· However, afterwords I opened the "Memory Map" to look for these values.· At the very bottom is the HEX code from the last program that I just ran.· It does not display the "stored values" from the photoresistor.· I know that I am probably missing something.· Can someone explain where these values are in the "Memory Map" window?· Thanks and have a good one.

Bob

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-07-21 00:30
    The "Memory Map" window doesn't know about locations used with a READ or WRITE statement. It only knows about the program itself which is stored in the upper end of the 2K memory slot and data in the DATA statement which is stored in the lower end of the 2K memory slot. A BS2 has one 2K memory slot while other Stamp models may have 8 or 16 2K memory slots.

    The DATA statement is used to initialize areas to be used by READ / WRITE statements, either to supply an initial value or to provide values for tables read with a READ statement.
    ·
  • tronsnavytronsnavy Posts: 70
    edited 2009-07-21 00:49
    Thanks Mike,

    Know a lot more about trons than programming. Persistance pays off.

    Have a good one.

    Bob
  • davejamesdavejames Posts: 4,047
    edited 2009-07-21 06:02
    I was just attempting to do something similar: send a byte from VB2005, receive it in the BS2, then write the value to memory location zero. When I opened the memory map in the Parallax IDE, nothing showed in address 0.

    Now I know why.

    Thanks Mr. Green and thank you Bob for asking the question.

    Regards,

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Instead of:

    "Those who can, do.· Those who can't, teach." (Shaw)
    I prefer:
    "Those who know, do.· Those who understand, teach." (Aristotle)
    ·
  • tronsnavytronsnavy Posts: 70
    edited 2009-07-24 01:16
    Mike is right again,

    Just finished activity #3 in chapter 8 (What's a Microcontroller?).· I was thinking about skipping this chapter (not big into music, except playing my own guitar... ROCK ON).· I decided that·the chapter·might teach me something about programming.· Sure enough, it did.· All data elements that were declared using the DATA statement showed up in the memory map window (although I had to convert the base 10 elements to HEX... DEC > BIN > HEX).· Thanks Mike.· Rock on and have a good one.

    Bob
    ·
  • davejamesdavejames Posts: 4,047
    edited 2009-07-24 14:02
    Bob,

    So in order to convert base-10 to HEX, one must go from decimal to binary to hex in PBasic? Can't go straight from decimal to hex? I admit I haven't read up on base conversions yet, although I think I might be required to do a conversion in a current project.

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Instead of:

    "Those who can, do.· Those who can't, teach." (Shaw)
    I prefer:
    "Those who know, do.· Those who understand, teach." (Aristotle)
    ·
  • davejamesdavejames Posts: 4,047
    edited 2009-07-24 14:04
    Well, I just read this thread and it shed some light on the subject of base conversion:

    http://forums.parallax.com/forums/default.aspx?f=5&m=370460


    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Instead of:

    "Those who can, do.· Those who can't, teach." (Shaw)
    I prefer:
    "Those who know, do.· Those who understand, teach." (Aristotle)
    ·
  • tronsnavytronsnavy Posts: 70
    edited 2009-07-25 01:15
    D],

    If you understand binary, you can convert DEC to BIN (then converting to HEX is easy)...... If you take a·BYTE (1111, 1111), each digit represents a·DEC number (MSD 1= 256, next is 128, then 64, then 32, then 16,...·the·next·sequence is·8,4,2 and finally 1 (LSD)).· Notice each corrisponding DEC digit is a mutliple of 2.· Thus, a number such as 56 (DEC)·= (0001, 1100) BIN..... i.e.·32·+ 16 + 8 = 56(DEC).··Once you have DEC converted to·BIN, you have (0001, 1100) BIN =·1C HEX.· 1C· (HEX) is·the same as 56 (DEC).· DEC = 0,1,2,3,4,5,6,7,8,9.· and HEX = 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F.··Hope this makes sense.· It's what I use if I need to convert using pencil/paper.· ROCK·ON and have a·good one.

    Bob
  • tronsnavytronsnavy Posts: 70
    edited 2009-07-25 01:42
    Sorry,

    56(DEC) = 21(HEX). BIN = MSD =128 (not 256), then 64, then 32, then 16.... then 8, 4, 2, 1. So, ***** 56 DEC = 21 HEX. Once again, sorry.

    Rock On.

    Bob
  • davejamesdavejames Posts: 4,047
    edited 2009-07-25 03:16
    Yup - understood. Actually, I'm right in the middle of the experiment on proving this using the IDE Debug window to view the data so this is all quite apropos.

    I've been tinkering with the BS2 for a year now and never had a need to delve into the byte/word/lowbyte/highbyte aspect. But I'll need it for a project and it's time to learn.

    Thanks much,

    DJ

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Instead of:

    "Those who can, do.· Those who can't, teach." (Shaw)
    I prefer:
    "Those who know, do.· Those who understand, teach." (Aristotle)
    ·
Sign In or Register to comment.