Shop OBEX P1 Docs P2 Docs Learn Events
can i use a value from excel — Parallax Forums

can i use a value from excel

mobile_bobmobile_bob Posts: 50
edited 2013-02-16 14:02 in BASIC Stamp
what i want to know is if it is possible to use a value from a cell in a spreadsheet such as excel
in my coding of a bs2 stamp

is there a variant of the bs2 that i can use to do this?

for instance if i were to set up a spreadsheet with A1 with the number 2 , A2 with the number 3, and then in A3 sum of A1 and A2= 5 (basic spreadsheet stuff)

is there a way to read the cell contents of A3 and use it in a program something like and if/then statement
IF (A3 = 5 or greater) then Goto

or something like that?

if it is possible, is there an example somewhere showing how this might be done.

failing that option

i can use a spreadsheet to get the values i need and reprogram the stamp each time there is a change in cell contents
to reflect that value, however i am not sure this is the best way to do it, or if it would quickly wear out the chip due to reprogramming on a daily basis.

so maybe i could take the values, put them into some sort of storage that the stamp can go to and read, and act upon based on the program that is in the stamp?

does that make sense.

any help or direction would be most appreciated. i know enough to make my project work as is very well, however having this added capability would be a huge next step for me.

thanks
bob g

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-12-05 21:25
    If you can have a connection between the BS2 and your PC running Excel (like a USB serial connection), you can use PLX-DAQ which is an Excel Add-in that lets the Stamp read a cell in an Excel worksheet.

    If you can only have a connection intermittently, you could use PLX-DAQ to read a value from Excel to the Stamp and use the WRITE statement to store the value in the Stamp's EEPROM for use when there's no connection to a PC. You'd have to initiate this operation by pushing a button or switch to tell the Stamp that there's a connection and it should try to read the value from Excel. The actual program in the BS2 wouldn't change although the area in the EEPROM where you'd store the value (in an area not used by the program) would change and can be changed > 1,000,000 times.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2012-12-05 21:32
    Hi Bob, it is possible to have an Excel spreadsheet template for a PBASIC program, such that
    variables in cells become part of a program that can be loaded into a BASIC Stamp. E.g., where $F$11, F27 and G27 are cell references that

    ="longitude DATA Word " & INT($F$11*100)
    ="DATA Word " & F27 & ", Word " & G27

    But I gather you are looking for a more dynamic coupling via a serial port or something like that.

    Have you looked into PLX-DAQ Real-Time Data Acquisition for Microsoft Excel? I'm not sure, but it looks like it is only one-way though, from Stamp to Excel.

    PS I see Mike already made the suggestion!
  • ajwardajward Posts: 1,130
    edited 2012-12-07 13:42
    I'm not 100% clear on serial communications with the Stamp... I've used it, but I'm still learning. From the other side, serial communication with Excel is certainly possible.
    A few years back, I wrote a program in Excel VBA that read weights from a digital scale into an Excel spreadsheet. The purpose was to evaluate variations in product weights in a plastic molding process. The program also determined the density of the raw materials based on volume and weight.
    After receiving data the program sent back information to zero or tare the scale.
    (Also, if weights were out of tolerance, the program would send an email to all departments and facilities involved with the product.)

    So... yeah, it can be done.

    Amanda
  • mobile_bobmobile_bob Posts: 50
    edited 2012-12-09 06:42
    thank you all for the reply, now that i know it is possible, i guess it is time for me to learn how it is done.

    bob g
  • Pavo98Pavo98 Posts: 4
    edited 2013-02-16 14:02
    Thank you for the reply.
    I had a same question.

    Greetings, Pavo. :)
Sign In or Register to comment.