Shop OBEX P1 Docs P2 Docs Learn Events
Read, Write and send data — Parallax Forums

Read, Write and send data

ArchiverArchiver Posts: 46,084
edited 2004-06-19 20:53 in General Discussion
Hi,

I am able to read/write data and display it on the screen. The hard
part is trying to take that data and be able to use it. I storing
different values using the write command like this:

write 0,124
write 1,342
write 2,221
write 3,230

Now, how do I assign these values commands. In other words I want
to say something like "If write 0=124 then startprogram". This
isn't working and I am hoping someone has dealt with this before.
Also, is there a command to clear all of the eeprom data I created?

Thanks in advance,

Chris

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-06-19 07:46
    At 06:20 AM 6/19/04 +0000, christopher41877 wrote:
    >Hi,
    >
    >I am able to read/write data and display it on the screen. The hard
    >part is trying to take that data and be able to use it. I storing
    >different values using the write command like this:
    >
    >write 0,124
    >write 1,342
    >write 2,221
    >write 3,230
    >
    >Now, how do I assign these values commands. In other words I want
    >to say something like "If write 0=124 then startprogram".

    Chris -

    Placing data INTO EEPROM is done with WRITE as you have done above.
    Retrieving data FROM EEPROM is done with READ. When you retrieve data from EEPROM you READ it into a VARIABLE. Check the manual for details, but
    a simple example is shown below:

    WRITE 0,124 'Place one byte of data in EEPROM location 0
    READ 0,Item 'Retrieve one byte of data from data location 0

    > This
    >isn't working and I am hoping someone has dealt with this before.
    >Also, is there a command to clear all of the eeprom data I created?

    No, you would have to do that manually. Remember there are just a finite number of WRITES that can be done to a EEPROM location before it wears out. See the manual for additional details.

    >Thanks in advance,
    >
    >Chris

    Regards,

    Bruce Bates
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-19 18:02
    You also need to look at the size of the stored data bit, byte, word .


    Larry Gaminde
    Original Message
    From: "Bruce Bates" <bvbates@u...>
    To: <basicstamps@yahoogroups.com>
    Sent: Friday, June 18, 2004 11:46 PM
    Subject: Re: [noparse][[/noparse]basicstamps] Read, Write and send data


    > At 06:20 AM 6/19/04 +0000, christopher41877 wrote:
    > >Hi,
    > >
    > >I am able to read/write data and display it on the screen. The hard
    > >part is trying to take that data and be able to use it. I storing
    > >different values using the write command like this:
    > >
    > >write 0,124
    > >write 1,342
    > >write 2,221
    > >write 3,230
    > >
    > >Now, how do I assign these values commands. In other words I want
    > >to say something like "If write 0=124 then startprogram".
    >
    > Chris -
    >
    > Placing data INTO EEPROM is done with WRITE as you have done above.
    > Retrieving data FROM EEPROM is done with READ. When you retrieve data from
    EEPROM you READ it into a VARIABLE. Check the manual for details, but
    > a simple example is shown below:
    >
    > WRITE 0,124 'Place one byte of data in EEPROM location 0
    > READ 0,Item 'Retrieve one byte of data from data location 0
    >
    > > This
    > >isn't working and I am hoping someone has dealt with this before.
    > >Also, is there a command to clear all of the eeprom data I created?
    >
    > No, you would have to do that manually. Remember there are just a finite
    number of WRITES that can be done to a EEPROM location before it wears out.
    See the manual for additional details.
    >
    > >Thanks in advance,
    > >
    > >Chris
    >
    > Regards,
    >
    > Bruce Bates
    >
    >
    >
    >
    > 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.
    >
    > Yahoo! Groups Links
    >
    >
    >
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2004-06-19 20:53
    Just a note on your WRITE code example below: Location 1 does not hold
    342 at the end of that sequence, it holds 86 -- the reason is that WRITE
    works with bytes and 342 is greater than what a byte can hold.

    Fix your code like this:

    WRITE 0, Word 124
    WRITE 2, Word 342
    WRITE 4, Word 221
    WRITE 6, Word 230

    By using the Word modifier, two bytes are used for storage, making room
    for changes that I assume will come.

    On your quest to "assign values to these commands", here's what I think
    you need to do:

    Get_Command:
    READ Location, Word command
    SELECT command
    CASE 124
    ' do something

    CASE 342
    ' do something

    ENDSELECT


    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office



    Original Message
    From: christopher41877 [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=wwYQwszmp_jezu7gVzS09qKf8ax0teUxLZDyJD7CUABxN0VcBQSq9fFazVoCQ8F16yN7Gjkj06E6x2AapzYP4yQtvS7RhQ]CHRIS@R...[/url
    Sent: Saturday, June 19, 2004 1:20 AM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Read, Write and send data


    Hi,

    I am able to read/write data and display it on the screen. The hard
    part is trying to take that data and be able to use it. I storing
    different values using the write command like this:

    write 0,124
    write 1,342
    write 2,221
    write 3,230

    Now, how do I assign these values commands. In other words I want
    to say something like "If write 0=124 then startprogram". This
    isn't working and I am hoping someone has dealt with this before.
    Also, is there a command to clear all of the eeprom data I created?

    Thanks in advance,

    Chris
Sign In or Register to comment.