Shop OBEX P1 Docs P2 Docs Learn Events
BS2 EEPROM / Datalogging Question — Parallax Forums

BS2 EEPROM / Datalogging Question

ProgressProgress Posts: 11
edited 2012-01-31 22:01 in BASIC Stamp
Hi Guys,
I am using a BASIC Stamp BS2 to send servo signals [1-2 ms]. I need to record these servo positions for 2 signals. These are held in "Word" variables since the values for Pulsout range from [500-1000]. So far I've found this chip which seems to be sufficient for my project. However, I have a few questions:
1. Is it possible to export the values recorded in the EEPROM into a text file or any other file which I can open / analyze in EXCEL, MATLAB, etc?
2. Am I correct in assuming if I use 2 of these it will provide me with ~5 mins of datalogging [4000 instructions / s on the BS2, 50 instr in my code, Word = 16bit]
3. Is there any sample code available? I know Parallax usually posts it in the store, but I don't see any available this time that's why I ask.
4. Is there a simpler / more efficient [writing time is critical] alternative to using EEPROM? I've heard of using SD cards / USB memory sticks with the BS2 to log data. Would that be more efficient and simpler to implement?

Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-01-28 09:42
    1) Not directly. You'd have to write a program on the stamp that would use something like StampPlot Pro or PLX-DAQ on an attached PC (see the Parallax Stamp Downloads page) to allow the Stamp to write to a file.

    2) Two will provide 128K bytes or 64K words. You can get bigger EEPROMs, up to 128K each and use up to 4 of them to get a total of 512K bytes or 256K words.

    3) The BS2 does not have built-in I2C statement like the BS2p Stamp models. There's a Nuts and Volts Column that provides examples of subroutines that can be used to do I2C on a BS2. The Nuts and Volts Column index is under the Resources tab on the main Parallax webpage.

    4) It takes about 5ms to write a byte to an EEPROM, You can write multiple bytes at once by using "page" mode, so you could write 4 bytes in about 5ms although the I2C routines will slow this down substantially. You'd be better off replacing the BS2 with one of the BS2p models since they wouldn't need the subroutines. SD cards and USB memory sticks have unpredictable delays in writing as the internal memory controller does its housekeeping. You can reduce the log size by storing one byte per servo. Subtract 500 from the PULSOUT value and shift right 1 bit. You'd represent the servo position by a value from 0-255. That's more than adequate given the mechanical resolution of most servos. You'd also gain from using a faster Stamp, like the BS2px.
  • ercoerco Posts: 20,256
    edited 2012-01-28 12:10
    Interesting record/playback project for 2 servos. I'd try to simplify and fit it all into a Stamp's 2K memory. The program will be very small, so most of the 2K memory is data. First, reduce resolution and compress PULSOUT values by 4 so they can be stored as bytes (1000 becomes 255). With fewer samples (or positions), you can stretch that 2K out for a while. Are you using pots to control the servos during recording?
  • ProgressProgress Posts: 11
    edited 2012-01-31 20:53
    Do I have to use I2C? I looked at the datasheet and it mentions serial communications, I've previously done serial communication with just a simple shiftin / shiftout with an ADC (MCP 3002 I think?). So communication with this guy will also be similar right? Just shiftin / shitout. Also, I think I will use your guys' advice on reducing the resolution of the signal.
  • Mike GreenMike Green Posts: 23,101
    edited 2012-01-31 22:01
    I2C is one kind of serial communications. SHIFTOUT and SHIFTIN provide a different and incompatible form of serial communications sometimes referred to as SPI and some EEPROMs are designed to use SPI. You have to use the devices made for the kind of communications you have available. SPI is usually faster than I2C, but requires more I/O pins.

    There is a type of EEPROM called FRAM made by Ramtron. It uses a different technology for storage and is much faster for writing than EEPROM. It comes in both I2C and SPI versions. It's more expensive than EEPROM, but, if you need the speed, it may be worth it. Have a look at Ramtron's website.
Sign In or Register to comment.