Shop OBEX P1 Docs P2 Docs Learn Events
Reading EEPROM from PC — Parallax Forums

Reading EEPROM from PC

Adriano72Adriano72 Posts: 22
edited 2009-05-27 17:45 in BASIC Stamp
Hi all,

I would like to read the Eeprom data of a BS2 without using the Basic Stamp Editor. For example, imagine that I build a temperature measurer that register checks done all day long and then I want to plug this device to the pc via USB and get the data so I can build reports etc...

How can I accomplish this task?

Thanks to all

Cheers

Adriano

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-27 15:50
    There is no practical way to directly access the EEPROM data from a PC. The normal way this is done is to have a jumper on your Stamp board that can be read from an I/O pin. In the initialization portion of your logging program, you have a test for the jumper setting and that goes to a portion of your program that communicates with the PC using DEBUG / DEBUGIN statements.

    The StampPlotPro program (which is available from Parallax for free non-commercial use) is intended for just this sort of use and can save PC files or plot / print downloaded data. Look at the documentation for it: www.parallax.com/tabid/441/Default.aspx
  • Adriano72Adriano72 Posts: 22
    edited 2009-05-27 16:10
    Thanks Mike,

    but I have not understood what do you mean about the jumper. Is not a jumper that tiny plastic removable switch? Like that one that switches between Vin and Vdd?
    And how can I read the jumper from the I/O pin?
    Forgive me but I'm very very newby.

    Thank you

    Adriano
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-05-27 16:22
    Adriano,


    Near the top of your program, have a statement similar to this:

    top:
      DEBUG "Press D to download data"
      SERIN 16,$54,2000,main,[noparse][[/noparse]char]
      IF char="D" THEN download   ' this happens only if user presses "D"
      ' also can have other commands, e.g. erase, set clock etc.
    main:
      DO
        ' collect data in locations 
      LOOP
    
    download:
      FOR index=0 TO endofdata STEP 2  ' read words
        READ index, Word result
        DEBUG SDEC result, CR   ' signed decimal results
      NEXT
      GOTO top
    
    



    Capture the data download in a program such as Hyperterminal. You also need means to erase the old data and to start over. There are several ways to do that, depending.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • Mike GreenMike Green Posts: 23,101
    edited 2009-05-27 16:47
    If a PC is connected to the Stamp, Tracy's suggestion displays a message, then waits 2 seconds for a character to be received. If nothing is received in 2 seconds, the program continues on as it would have before (at main). If a "D" is received, it dumps data to the PC where a program like HyperTerminal can store it in a file.

    My suggestion was to do pretty much the same thing, but to use the setting of a jumper instead of typing a "D" on the PC.

    A jumper is just a wire that connects two points on a circuit board. These days, it's usually a set of pins sticking up from a printed circuit board, commonly on a 0.1" grid. There are molded connector blocks that can be installed over a pair of pins that connect them together. In this case, one pin would be connected to a Stamp I/O pin with a 10K resistor connected between the I/O pin and Vdd. This provides a default voltage of +Vdd on the I/O pin. The other jumper pin is just connected to ground (Vss). If the connector block is absent, the I/O pin reads high (1). If the connector block is installed, the I/O pin reads low (0). There are examples in the Stamp Basic Syntax and Reference Manual of reading the state of an I/O pin. If you're using I/O pin 11, you'd use the value of IN11 in your program.
  • Adriano72Adriano72 Posts: 22
    edited 2009-05-27 17:45
    Thank you very much Mike and Tracy!

    I'll do some tests and quite sure I'll be back with more questions...

    A great hug!

    cheers

    Adriano
Sign In or Register to comment.