PDA

View Full Version : Can I use Excel 2007 to read PLX-DAQ?



Loyd
10-31-2009, 04:46 AM
Hi all.

I am very new at this and find this forum very helpful. Thank you all.

I am buliding a linear transducer to measure waves on a Bachelor project.
I bought two PING))) modules to do the job. They are working fine, but I need to log the data for further calculations.
I have downloaded the StampPlot Pro, witch is also working fine, but I would rather have the data in Excel where I can easier make the calculations i need.
I have downloaded the PLX-DAQ but I cant get it to read the stamp. I am using Excel 2007. Is this the problem?
I am also using a USB connection. This is not a problem with theˇStampPlot Pro. It is finding the stamp in port 5.

Any suggestions?

Kind regards
Loyd Nornes
Norway

sylvie369
10-31-2009, 05:25 AM
I have had no trouble using PLX/DAQ with Excel 2007.

Can you describe the problem that you're having? What is it not doing? (or doing that it shouldn't be?).

You might also want to attach your Basic Stamp code. Have you thought about monitoring the USB port through a terminal program to make sure that the Stamp is sending the data and commands that you want it to send?

Loyd
10-31-2009, 06:28 AM
Hi,
that was quick. Tank you.

Whaen I am using the StampPlot Pro I reads the signals from the stamp as it should. Also in the Debug terminal.
When I run the PLX-DAQ nothing is recorded. No information is written in Excel cells.
I am very new at this so there might be somthing I am doing terrably wrong.

The programs I use for testing are these two I found at the download page for the PLX-DAQ.



'{$STAMP BS2}
'{$PBASIC 2.5}
'************* Interactive Bar Graph PLX-DAQ Example **************
' Program will send data on to be placed in 2 cells in PLX-DAQ
' Which will be graphed as bar graphs.
' Use the "Interactive Bar Graph" sheet in PLX-DAQ.

' Change the "Delay" time in Excel to be read by the BASIC Stamp

' Check "Reset Stamp on Connect" to catch configuration data.

' Updated: January, 2007
' By Martin Hebel
' SelmaWare Solutions - www.selmaware.com
' Southern Illinois University Carbondale - www.siu.edu/~isat/est

'***************** PLX-DAQ data structures ****************
' SEROUT Sends serial data from programming port (P16)
' [ ] defines data to be sent.

' PLX-DAQ directives used:
' CELL,SET Sets the specified cell in Excel to the value
' number or string.
' CELLSET,A2,HELLO

' CELL,GET Gets the specified cell's value in Excel
' to be accepted by the BASIC Stamp
' CELLGET,D5


' USER1,LABEL Sets the User1 checkbox in the control to string specified
' USER1,LABEL,Check me!

' USER1,GET Returns the value of the USER1 checkbox back to the BASIC Stamp
' 0 = unchecked, 1 = checked

' USER1,SET Sets the USER1 check box to checked (1) or unchecked (0)
' USER1,SET,0
'
'************************************************* *************

X VAR Byte 'Variable to represent data
sPin CON 16 'Serial Pin - P16, Programming port
Baud CON 84 'Baud mode for a rate of 9600, 8-N-1
'BS2P, BS2SX use 240 for 9600, 8-N-1

Delay_Cell_Label CON $A4 ' Specify cells (hex values can be used
SIN_Cell_Label CON $A6 ' up to column F)
COS_Cell_Label CON $A7
Delay_Text CON $C4

Delay_Cell CON $B4
SIN_Cell CON $B6
COS_Cell CON $B7

Delay VAR Word ' Holds delay value read from Excel
chkDelay VAR Bit ' Holds status of USER1 checkbox

'************************************************* *************
Delay = 1000
PAUSE 1000 'Allow data communications to stabilize
SEROUT sPin,Baud,[CR] 'Send a lone CR to ensure PLX-DAQ buffer is ready

' Label and fill in initial values of cells
SEROUT sPin,Baud,["CELL,SET,", HEX Delay_Cell_Label,", Delay (mSec):",CR]
SEROUT sPin,Baud,["CELL,SET,", HEX Delay_Cell,",1000",CR]
SEROUT sPin,Baud,["CELL,SET,", HEX Delay_Text,",Change value and click 'Update Delay' in control",CR]
SEROUT sPin,Baud,["CELL,SET,", HEX SIN_Cell_Label,", SIN X",CR]
SEROUT sPin,Baud,["CELL,SET,", HEX COS_Cell_Label,", COS X",CR]

' Label USER1 checkbox
SEROUT sPin,Baud,["STORED,LABEL,Update Delay",CR]

DO
x = x + 1
' Place data in cells for graphing
SEROUT sPin,Baud,["CELL,SET,", HEX SIN_Cell,",", SDEC SIN X,CR]
SEROUT sPin,Baud,["CELL,SET,", HEX COS_Cell,",", SDEC COS X,CR]

' Read USER1 checkbox
SEROUT sPin,Baud,["USER1,GET",CR]
SERIN sPin,Baud,50,Timeout,[DEC chkDelay]
' IF checked, read new delay time
IF chkDelay = 1 THEN
SEROUT sPin,Baud,["CELL,GET,", HEX Delay_Cell,CR ]
SERIN sPin,Baud,50,Timeout,[DEC Delay]
'Uncheck USER1 box
SEROUT sPin,Baud,["USER1,SET,0",CR]
ENDIF
Timeout:
PAUSE Delay
LOOP



And this one.None of them are working for me.


'{$STAMP BS2}
'{$PBASIC 2.5}
'***************** Simple PLX-DAQ Example *****************
' Simple PLX-DAQ routine for data.
' Program will send data on serial port to be
' accepted and placed into an Excel worksheet.

' This program also demonstrates reading the current ROW from Excel,
' and starting over again once it meets to exceeds 300.

' Check "Reset Stamp on Connect" to catch configuration data.

' January, 2007
' By Martin Hebel
' SelmaWare Solutions - www.selmaware.com
' Southern Illinois University Carbondale - www.siu.edu/~isat/est

'***************** PLX-DAQ data structures Used ****************
' SEROUT Sends serial data from programming port (P16)
' [ ] defines data to be sent.

' PLX-DAQ directives used:
' DATA Places data into the next row of Excel spreadsheet
' Up to 26 comma-separated values may be stored.
' Each value following "DATA," must be separated by comma-strings ","
' DATA,val1,val2,val3...Val26
' DATA,TIME, decimal value of X, Signed-Decimal value of X

' TIME Replaced by PLX-DAQ with real system time (DATE may also be used)
' in DATA directive. Column cells should be formatted for time.

' TIMER Replaced by PLX-DAQ with the seconds since last may also be used
' to show time since last RESETTIMER.
' Column should NOT be formatted for 'Time'.

' LABEL Places headings on the columns for rows A-J using up to
' 10 comma-separated labels.
' LABEL,label1,label2,...label10

' CLEARSHEET Clears columns A-J, rows 2 and on. (labels remain).
' RESETTIMER Resets the timer to 0.
'
' ROW,GET Requests the last row data went into.
' Accept returning data with SERIN pin, baud,[dec variable]

' ROW,SET,val Sets the row the next data set will use.
'************************************************* *************

X VAR Byte 'Variable to represent data
sPin CON 16 'Serial Pin - P16, Programming port
Baud CON 84 'Baud mode for a rate of 9600, 8-N-1
'BS2P, BS2SX use 240 for 9600, 8-N-1
Row VAR Word 'Variable to hold row data
'************************************************* *************

PAUSE 1000 'Allow data communications to stabilize
SEROUT sPin,Baud,[CR] 'Send a lone CR to ensure PLX-DAQ buffer is ready

'Label 3 columns with TIME, X, and SIN X
SEROUT sPin,Baud,[CR,"LABEL,Time,Timer,X,SIN X",CR]
SEROUT sPin,Baud,["CLEARDATA",CR] 'Clear all data columns (A-J) in Excel
SEROUT sPin,Baud,["RESETTIMER",CR] 'Reset Timer to 0

DO
FOR X = 0 TO 255 'Count from 0 to 255
' Send String with data for Excel
SEROUT sPin,Baud,["DATA,TIME,TIMER,", DEC X, ",", SDEC SIN X,CR]
' Request last row of data
SEROUT sPin,Baud,["ROW,GET",CR]
' Accept returning data and store into Row with 200mS timeout
SERIN sPin, Baud,200,TimeOut,[DEC Row]
' If Row is or exceeds 300, set row back to 2
IF row >= 300 THEN SEROUT sPin,Baud,["ROW,SET,2",CR]
Timeout:
NEXT
LOOP


Kind regards
Loyd

JD
10-31-2009, 08:00 AM
Loyd,

What version of Windows do you have installed?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Respectfully,


Joshua Donelson
www.parallax.com (http://www.parallax.com)

Loyd
10-31-2009, 05:12 PM
Hi

I am running Windows Vista Home Premium.

I read the PLX-DAQ help "guide". I set the Macros to the lowest security levels.
No success.

Loyd

sylvie369
10-31-2009, 11:50 PM
When you start up the PLX/DAQ Excel file, do you get the warning bar about macros being disabled?
Are you clicking "Options" to get to the window where you can enable macros? You click "Enable this content" in that window, then "OK" in the next one.
Then you should get the little program window that allows you to connect. Does it connect when you click that button?
When it connects, and your Stamp is powered up, do you get activity in the middle "R" indicator in that window? As it receives data, it should blink.

ˇYour code is trying to do an awful lot at once. How about a simple attempt to just set the labels at the top of the columns?



'{$STAMP BS2} ' Replace this with the directive for whatever Stamp module you're using
'{$PBASIC 2.5}
SERPin CON 16
Baud CON 84 ' This will also need to be the appropriate Baud code for your Stamp: 84, if you're using a BS2, 2e, or 2pe


PAUSE 1000 'Allow data communications to stabilize
SEROUT SERPin,Baud,[CR] 'Send a lone CR to ensure PLX-DAQ buffer is ready
SEROUT SERPin,Baud,[CR,"LABEL,Time,Timer,Alt",CR]

If you run this code with a working setup, the first three columns should get labels reading "Time" , "Timer", and "Alt". I just ran it on a BS2 OEM (with the $STAMP directive set to BS2 and the Baud to 84, of course), and it works fine for me (Excel 2007, Vista Home). If that works, then try this:



'{$STAMP BS2}
'{$PBASIC 2.5}
SERPin CON 16
Baud CON 84
PAUSE 1000 'Allow data communications to stabilize
SEROUT SERPin,Baud,[CR] 'Send a lone CR to ensure PLX-DAQ buffer is ready
SEROUT SERPin,Baud,[CR,"LABEL,Time,Timex,Alt",CR]
SEROUT SERPin,Baud,["CLEARDATA",CR] 'Clear all data columns (A-J) in Excel
SEROUT SERPin,Baud,["RESETTIMER",CR] 'Reset Timer to 0

ˇYou should also get messages in the little program window, ending with "Timer Reset". Then try to send some data:



'{$STAMP BS2}
'{$PBASIC 2.5}
SERPin CON 16
Baud CON 84
alt VAR Word
PAUSE 1000 'Allow data communications to stabilize
SEROUT SERPin,Baud,[CR] 'Send a lone CR to ensure PLX-DAQ buffer is ready
SEROUT SERPin,Baud,[CR,"LABEL,Time,Timex,Alt",CR]
SEROUT SERPin,Baud,["CLEARDATA",CR] 'Clear all data columns (A-J) in Excel
SEROUT SERPin,Baud,["RESETTIMER",CR] 'Reset Timer to 0
alt = 36
SEROUT SERPin,Baud,["DATA,TIME,TIMER,", DEC alt,CR]

You should get a current time, a current timer reading, and the number "36" in the first row under your labels.



If this doesn't work, tell us exactly how far you're getting, and what is not happening the way it's supposed to.

Post Edited (sylvie369) : 10/31/2009 4:06:49 PM GMT

Loyd
11-01-2009, 01:34 AM
Hi

I get a warning about Active-X beeing initialized.
My macros security level is the lowest.

In the PLX-DAQ control box the C is green so it is connected.
When the stamp is sending data the R flashesa red, but the T is always green. I belive that means that no data are beeing transmitted.
Is that right? I dont understand this. I belive the R indicates data recived. How can it recive data when no data is beeing transmitted?

I tryed all your programs with nos success.

Loyd

sylvie369
11-02-2009, 01:08 AM
Loyd said...
Hi

I get a warning about Active-X beeing initialized.
My macros security level is the lowest.

In the PLX-DAQ control box the C is green so it is connected.
When the stamp is sending data the R flashesa red, but the T is always green. I belive that means that no data are beeing transmitted.
Is that right? I dont understand this. I belive the R indicates data recived. How can it recive data when no data is beeing transmitted?

I tryed all your programs with nos success.

Loyd
Okay, then, I think that your problem must be in either Windows security or the nature of your serial port.

First, check to make sure that the R light flashes ONLY when you believe the Stamp is sending data. That is, what happens when you do everything the same, but don't power up your Stamp? If it still flashes, you're probably not getting data from the Stamp, but from some other activity. If not - if it flashes if and only if the Stamp is sending data, then that part is okay. Are you connecting at 9600? Somehow using the wrong baud setting would give you data in but nothing read into Excel (though I believe it would not connect at all). You said that you can connect through a serial terminal and see the correct data on the screen, right? That'd mean that the serial port/settings is probably not the problem.

The "T" light on PLX/DAQ does not indicate that data have been sent from the Stamp to the computer, but rather the other way around - from your computer to your Stamp. The computer will not transmit data to the Stamp unless you explicitly tell it to do so, and I don't think that you are. You certainly are not in any of the program snippets I posted.
However, the computer WILL receive data that the Stamp sends out the serial port, simply because the Stamp is sending those data.

The other alternative, I think, is that your security settings are somehow preventing this from working. If that's the problem, it's beyond me. I know nothing about Windows security. However, I do know that in order to use a macro-enabled worksheet like PLX/DAQ, you typically need to explicitly tell Windows that it's okay. I do, anyway. Why don't you turn the macros security level UP a notch, and see if it generates a new warning message when you run PLX/DAQ?
ˇ

dronethebone
12-08-2009, 10:33 AM
I also had a great deal of trouble getting PLX-DAQ and StampPlot Pro to work. I am running Excel 2007 under Windows XP, and I have a USB-to-serial adapter. The last thing I tried before both programs began to work was to renumber my serial port to COM1, when it had been named COM4. (did this in Control Panel - opened Device Manager, selected USB, Properties, Port Settings, Advanced, chose "COM1" or "Port1" or similar.)

I also turned Macro Security off before that.

Also I note that I must start PLX-DAQ running BEFORE running the BS2 program, else PLX-DAQ complains that the port is unavailable, or something like that.

Woody