Shop OBEX P1 Docs P2 Docs Learn Events
Syntax and number formating questions — Parallax Forums

Syntax and number formating questions

Eyepuff2Eyepuff2 Posts: 4
edited 2008-05-28 20:30 in BASIC Stamp
Hi all,

This is my first post and first attempt at a project with a Stamp controller. I have reviewed the BASIC Stamp programming and reference manual and looked through coding examples, but can't seem to find an elegant solution.

I am using the RFID kit with a BS2. I can read tag id's into a 10 byte array using the following;

SERIN RX, T2400, 1000, jump,[noparse][[/noparse]STR buf\10] where buf is defined as Byte(10).

I would like to write this to EEPROM memory. Is there an elegant way to do this? I would like to minimize the number of variables used for reading and writing the RFID tags, as the BS2 has 32 bytes of RAM.

Best,

Chris

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-05-28 17:20
    Take a look at the read and write commands in the help files of the editor.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Eyepuff2Eyepuff2 Posts: 4
    edited 2008-05-28 17:52
    Stephen,

    Thanks for the reply - I did look at the help files. Based on what I see there - I will need to create 10 seperate variables to write the value I have already in the buf variable.

    Is there some way to write this array directly to EEPROM without creating multiple variables?

    Thanks again.

    Post Edited (Eyepuff2) : 5/28/2008 5:57:38 PM GMT
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-28 18:19
    FOR I = 0 to 9
    · WRITE I, Buf[noparse][[/noparse]I]
    Next

    That's so hard?· And yes, you'll need

    I VAR NIB

    for this.· Note you can "wear out" EEPROM if you write it 100,000 times or more.· Usually not a problem, depends on how often you'll be updating this string.
  • ercoerco Posts: 20,261
    edited 2008-05-28 18:23
    Simplicity itself on the BS2. Check the manual at http://www.parallax.com/dl/docs/prod/stamps/BasicStampMan.pdf

    Write 0,x0 stores x0 in EEPROM location 0. Then use Write 1, x1, and write 2, x2... up to write 10, x10 in your case for 10 variables. You don't need an array, just make a for-next loop to write them in sequentially as you read the RFID tags, then plan to READ them out from EEPROM sequentially, too.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."

    Post Edited (erco) : 5/28/2008 9:04:16 PM GMT
  • Eyepuff2Eyepuff2 Posts: 4
    edited 2008-05-28 18:44
    Gentlemen,

    Thanks for the help. I think I can make it work.

    Nothing is hard when you know how to do it.

    Best,

    Chris
  • Eyepuff2Eyepuff2 Posts: 4
    edited 2008-05-28 19:11
    I am having trouble with the syntax. The buf does not work - I get the "Expected',', end-of-line, or ':'" Error.

    Any ideas?

    got it ... need paranthesis not brackets

    Thanks

    Post Edited (Eyepuff2) : 5/28/2008 7:27:15 PM GMT

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-05-28 20:30
    (Note:· The original had "buf[noparse][[/noparse]I]" before it got 'converted'.· Bug?· I "edited" it to put this in without conversion.)
    Yeah, somehow when I put "buf" -- it gets converted to italics after that. Interesting.

    ·
Sign In or Register to comment.