Shop OBEX P1 Docs P2 Docs Learn Events
BS2E...Read/Write problem — Parallax Forums

BS2E...Read/Write problem

ArchiverArchiver Posts: 46,084
edited 2000-09-04 18:29 in General Discussion
Hello everyone,

I've been trying to get both the BS2-IC and the BS2E-IC
to accept Read/Write commands within my program,
but when I turn the power off/on I find out the EEprom
didn't seem to accept the write command. I have tryed
the sample programs in the basic stamp manual ver 1.9 .
but can't seem to make them work. If anyone has some
answers or maybe examples of some source code to do
this command, I would greatly appreciate it! Do I need to
enter other directives in the beginning of the program to
enable the read/write commands to eeprom(Stamps)....
Thanks!!!
jim

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-09-04 17:25
    Jim,

    I am using a bs-2 for an air conditioner load controller.
    The eeprom stores thermostat setting, duty cycle, etc.
    that are essential for an orderly program startup after a
    power interruption.

    Here's some code:

    set1 var word
    set2 var byte

    At the program start reserve 16 bytes of eeprom storage

    settings data ($10)

    Read/write in body of program

    read 0, set1.lowbyte
    read 1, set1.highbyte
    read 2, set2
    .
    .

    write 0, set1.lowbyte
    write 1, set1.highbyte
    write 2, set2
    .
    .

    Note that the read/write transfers only one byte at a time.
    To transfer a word, two read/write instructions are necessary.

    Hope this helps,
    Adolph Stumpf



    --- In basicstamps@egroups.com, opburg89@a... wrote:
    > Hello everyone,
    >
    > I've been trying to get both the BS2-IC and the BS2E-IC
    > to accept Read/Write commands within my program,
    > but when I turn the power off/on I find out the EEprom
    > didn't seem to accept the write command. I have tryed
    > the sample programs in the basic stamp manual ver 1.9 .
    > but can't seem to make them work. If anyone has some
    > answers or maybe examples of some source code to do
    > this command, I would greatly appreciate it! Do I need to
    > enter other directives in the beginning of the program to
    > enable the read/write commands to eeprom(Stamps)....
    > Thanks!!!
    > jim
  • ArchiverArchiver Posts: 46,084
    edited 2000-09-04 18:29
    Hi Jim,

    It does work, and no other directives are necessary. Try the following
    program. The value of x displayed on the debug screen should increase by 1
    each time you press the reset button, or each time you remove and reapply
    power.

    x var byte
    main:
    read 0,x ' read contents of eeprom address zero
    debug ? x ' show it
    x=x+1 ' add one to x
    write 0,x ' store it
    end ' wait for reset or power-on

    hope that helps,
    -- Tracy



    > I've been trying to get both the BS2-IC and the BS2E-IC
    > to accept Read/Write commands within my program,
    > but when I turn the power off/on I find out the EEprom
    > didn't seem to accept the write command. I have tryed
    > the sample programs in the basic stamp manual ver 1.9 .
    > but can't seem to make them work. If anyone has some
    > answers or maybe examples of some source code to do
    > this command, I would greatly appreciate it! Do I need to
    > enter other directives in the beginning of the program to
    > enable the read/write commands to eeprom(Stamps)....
    > Thanks!!!
    > jim
Sign In or Register to comment.