Shop OBEX P1 Docs P2 Docs Learn Events
Has anybody written a Windows application that downloads data to a BS2 EEPROM? — Parallax Forums

Has anybody written a Windows application that downloads data to a BS2 EEPROM?

davejamesdavejames Posts: 4,047
edited 2008-06-09 19:14 in General Discussion
Hi All,

I'm almost afraid to ask this question for fear of not understanding the responses...but here goes...

I have a project that requires the user to input data, and then save the data out to the EEPROM which the program will use.

There're 3 ways I can see doing this:

1 - have the user modify DATA statements in the code with the desired values (I've done this but it exposes the program code to the user, not good)
2 - use a bunch of switches for the user to toggle that represents the desired values, the BS2 would read them and save the data to EEPROM (working on that right now, a little cumbersome but feasible)
3 - write up a stand alone Windows application that would allow the user to input the required data via a GUI and then write the data out to the EEPROM.

I like the idea of #2 because it doesn't require any external equipment, but the user might find it too cumbersome to use. I like the idea of #3 because it would look cool and it'd be easier for the user...but I have *absolutely* no clue on how to implement this type of solution. And that's where I was wondering if anyone has done this.

So, all that to say (in summation)....

I'm using a BS2 running PBASIC 2.5 and I have a need to develop a Windows application that will receive input from the user and then write the data out to the BS2 EEPROM. The BS2 has already been loaded with a program that will retrieve the data and put it to use. I have Visual Studio C++ v6.0 at hand to use for the development and will consider obtaining Visual Basic if it would help (or be easier on me).

Can anyone point me in the direction of my first stage of enlightenment?

Thanks much,

DJ

Comments

  • VelocitVelocit Posts: 119
    edited 2008-06-05 20:37
    Option three seems like the most straightforward and professional to me. The BS2 EEPROM is an I2C device. To to interface with a PC, I would use some sort of an RS-232 to I2C converter. I'm sure there are commercial solutions available, but I would probably just use an SX chip with a level converter... it could do the job easily. As for the PC interface, Visual Basic 2008 Express is free and very useful. It's easy to make a small application that takes user input and sends it to the I2C converter through either a built-in serial port, or a virtual COM port (i.e. a USB to serial converter).

    If you're familiar with PBASIC, there is a small learning curve for mastering SX/B, the BASIC variant used for programming SX chips. They have a built-in command set for both serial and I2C communications. Take a look at the MAX232 datasheets for hints on how to interface with the PC, and the EEPROM datasheet for hints on how to interface with that.

    www.parallax.com/Portals/0/Downloads/docs/prod/oem/24LC128-v2.0.pdf

    Take a look here for tips on getting started interfacing to the SX via the PC:

    www.instructables.com/id/Control-real-world-devices-with-your-PC/

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Paul
  • Mike GreenMike Green Posts: 23,101
    edited 2008-06-05 20:42
    The Basic Stamp Tokenizer downloads include a document that describes the download protocol for the Stamp's EEPROM (www.parallax.com/BASICStampTokenizer/tabid/390/Default.aspx). Note that this doesn't describe the format of the data sent to the Stamp. It assumes that you will use the Tokenizer to compile a PBasic program including its data and download that. Any other writing of data to the Stamp's EEPROM has to be done by using the WRITE statement of PBasic. You would load your BS2 with a program that optionally accepts data from Windows and writes it to the EEPROM. There's no way to do this without a program on the Stamp handling the actual process. Given that, you can create your Windows GUI any way you want and similarly create a matching program for the Stamp end.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-05 21:49
    DJ,

    I agree with Paul in that option 3 seems the most professional and easier for an end-user. One downside is code overhead. Depending on the size of your program you may or may not have sufficient program space to create an interactive system. You would also need to handle when this code was run….For example, some systems on power-up look for an external key press to know if they need to go into configuration mode.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • davejamesdavejames Posts: 4,047
    edited 2008-06-05 22:03
    .....hmmmmmm.....ok, I'll go away and read the links provided. All of your comments have generated more questions which will have to percolate around the grey matter for a bit.

    Thanks much.

    Shuffling back into the cave,

    DJ
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2008-06-06 15:15
    Hi DJ, how many memory locations is the operator expected to write to and is this number always the same or does it vary. Is this data numerical if so what would be the highest value a byte or word. Also is data entered on the fly or is the program restarted (or can it be restarted ) after each new data entry. Lastly do you have enough program/variable·space for a short routine to manage the user input.

    Jeff T.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-06 15:42
    My thoughts are that if you’re going to write a windows application to enter the data, it could open the COM Port that the BASIC Stamp is connected to and await a special string from that port which would only be sent by the BASIC Stamp at startup time.

    The BASIC Stamp program would timeout if it got no response from the windows application allowing it to run normally. However, if it got a response, all the entered data would be downloaded at once and written to pre-determined EEPROM locations. This would actually take very little code space if done in this manner and if the BASIC Stamp were not responsible for generating the prompts for input directly, such as in text based (terminal).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • davejamesdavejames Posts: 4,047
    edited 2008-06-07 00:11
    Jeff T - there will be 14 "groups" of 10 bits each that could be modified by the user. The opportunity to enter the data would be when the BS2 is powered up. I *think* there will be enough room for both the program code and this user-entered data. The data would consist of, possibly 10 1s and/or 0s...or a decimal number to represent said 10 1s and/or 0s.

    Mr. Savage - your suggestion sounds intriguing...are there any resources at which you might point me?

    I'll be conducting an out-of-state, customer class for the next 2 weeks so there will plenty of time for me to read through all the provided links during the evening hours in the hotel.

    Thanks to you both,

    DJ
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-06-09 15:15
    DJ,

    Anything that uses VB to communicate serially with help you with that part of it. The main thing is to ACKnowledge messages from the BASIC Stamp so it knows the config program is listening. Otherwise just continue on with normal operation.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • davejamesdavejames Posts: 4,047
    edited 2008-06-09 19:14
    Mr. Savage,

    Thanks for the direction.· I'll be busy readin'...

    DJ
    ·
Sign In or Register to comment.