Shop OBEX P1 Docs P2 Docs Learn Events
DS1302 RAM Space — Parallax Forums

DS1302 RAM Space

sam_sam_samsam_sam_sam Posts: 2,286
edited 2009-06-12 18:43 in General Discussion

I want to make sure that I understand what they have here
RAM
The static RAM is 31 x 8 bytes addressed consecutively

in the RAM address space.

So a word would that take two address space
and a byte would take one address space

I am saving these values

P Basic Code
PS· VAR· WORD
S··· VAR· BYTE

Do I have this right

·I would have used three spaces

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

·
·
·
·
Sam

Comments

  • MoskogMoskog Posts: 554
    edited 2009-06-09 06:47
    Sam



    I would rather say 31 bytes, or 31 X 8 bits. And I agree with you that if you·save one word and one byte you have used 3 spaces.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-06-09 15:53
    Moskog is correct. And a word can be written out as separate lowbyte/highbyte values to make it easier. While you save some code burst writing data in/out of the DS1302, the fact is that the DS1302 has more RAM locations than the BASIC Stamp has available variables. For this reason I have a subroutine and read/write variables to the DS1302 RAM one at a time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-06-10 00:24
    Chris

    Thank you for confirming what I thought· was my understanding what I was reading

    Is there an easy way to use all of the ram space on the DS1302 chip with a Basic Stamp

    For this reason I have a subroutine and read/write variables to the DS1302 RAM one at a time.

    Could you share this SubRoutine ·with me that you are talking about

    I just have learned·how to·read and write to the·RAM on the·DS1302 Chip


    Moskog

    Thank you for confirming what I thought· was my understanding what I was reading

    Thank for point out this

    I would rather say 31 bytes, or 31 X 8 bits.

    31 X 8 bits. This threw off a little of what I was reading that is why want to make I was understanding right

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-06-10 15:28
    Sam,

    There is no benefit to using the burst mode to write to the DS1302 RAM since you’re not going to write 31 bytes all at once anyway…however you can use the entire 31 bytes by writing randomly. This is how most of my programs utilize the RAM. That subroutine I posted earlier (from the DS1302 Demo Code) is the key. You set the address and value to store and call the subroutine. To read RAM you simply set the address and call the subroutine and the value is returned in the variable you set for writing.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-06-12 00:33
    Chris

    Could you post the routine of how you do this

    I have try ed to get this to work but have had no luck with it

    However you can use the entire 31 bytes by writing randomly. This is how most of my programs utilize the RAM. That subroutine I posted earlier (from the DS1302 Demo Code) is the key. You set the address and value to store and call the subroutine. To read RAM you simply set the address and call the subroutine and the value is returned in the variable you set for writing.

    I guess I do understand how to this But I do want to learn how to do it

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam
  • Mike GreenMike Green Posts: 23,101
    edited 2009-06-12 00:39
    Look at the sample code for the DS1302. There are links on Parallax's webstore page for the DS1302 and there are Nuts and Volts Columns with information. The Nuts and Volts index can be reached from the main Parallax website. Click on the Resources tab and you'll see the link.
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2009-06-12 05:18
    Thank Mike for the link

    But this is in the burst mode



    What·I want to do is what Chris was talk about in his post

    you can use the entire 31 bytes by writing randomly.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them smile.gif

    ·
    ·
    ·
    ·
    Sam
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-06-12 18:43
    The examples are not in burst mode…only the time/date data is read/written using burst mode. Mike is right…in the DS1302 Demo Code the RAM is randomly read/written using a single subroutine. That is your best example.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
Sign In or Register to comment.