Shop OBEX P1 Docs P2 Docs Learn Events
Basic Stamp: PLX-DAQ Real-Time Data Acquisition for Microsoft Excel — Parallax Forums

Basic Stamp: PLX-DAQ Real-Time Data Acquisition for Microsoft Excel

StomperStomper Posts: 5
edited 2009-03-24 06:52 in BASIC Stamp
I need help with getting the data out of the program below and making it flow into excel!
' =========================================================================
'
' File....... H48C_3-Axis.BS2
' Purpose.... Hitachi H48C 3-Axis Accelerometer Demonstration
' Author..... Copyright (c) 2005-2006 Parallax, Inc.
' E-mail..... support@parallax.com
' Started....
' Updated.... 02 FEB 2006
'
' {$STAMP BS2}
' {$PBASIC 2.5}
'
' =========================================================================
'
[noparse][[/noparse] I/O Definitions ]
Dio PIN 15 ' data to/from module
Clk PIN 14 ' clock output
CS PIN 13 ' active-low chip select
'
[noparse][[/noparse] Constants ]
MemoryAddress = 0
XAxis CON 0 ' adc channels
YAxis CON 1
ZAxis CON 2
VRef CON 3
Cnt2Mv CON $CE4C ' counts to millivolts
' 0.80586 with **
GfCnv CON $3852 ' g-force conversion
' 0.22 with **
'
[noparse][[/noparse] Variables ]
Msg1 DATA "BS2", CR, "EEPROM Storage!", 200
Char VAR Byte
MemoryAddress VAR Word
LoopCounter VAR Word
axis VAR Nib ' axis selection
rvCount VAR Word ' ref voltage adc counts
axCount VAR Word ' axis voltage adc counts
mVolts VAR Word ' millivolts
gForce VAR Word ' axis g-force
dValue VAR Word ' display value
dPad VAR Nib ' display pad
Gpad VAR Word
'
[noparse][[/noparse] Initialization ]
Reset:
HIGH CS ' deselect module
DEBUG CLS, ' paint display
"=========================", CR,
"H48C 3-Axis Accelerometer", CR,
CR,
" Count Volts G ", CR,
"VRef ", CR,
" X ","
","y","
","z", CR

'
[noparse][[/noparse] Program Code ]
Main:
DEBUG CRSRXY, 6, 6
FOR LoopCounter = 1 TO 5
· FOR axis = XAxis TO ZAxis ' loop through each axis
··· GOSUB Get_H48C ' read vRef & axis counts
··· dValue = rvCount ' display vRef count
··· ' calculate g-force
··· ' -- "gForce" is signed word
··· IF (axCount >= rvCount) THEN
····· gForce = (axCount - rvCount) ** GfCnv ' positive g-force
··· ELSE
····· gForce = -((rvCount - axCount) ** GfCnv) ' negative g-force\
··· ENDIF
··· DEBUG CRSRXY, 20+2*axis, (7 + LoopCounter), ' display g-force
··· " " + (gForce.BIT15 * 13),
····· DEC3 (ABS(gForce) ), ".",CR
···· ' DEC2 ABS(gForce)
·· DEBUG CRSRXY, 55, 3, SDEC ? gforce
·· WRITE MemoryAddress, gForce
·· DEBUG CRSRXY, 55, 4, SDEC ? memoryaddress
····· MemoryAddress = Msg1 ' set to start of message
········ GOSUB String_Out
········ String_Out:
········ READ MemoryAddress, char ' read byte from EEPROM
······· MemoryAddress = MemoryAddress + 1 ' point to next character
········ IF (char = 200) THEN EXIT ' if 0, exit routine
········ DEBUG char
·NEXT
PAUSE 20
NEXT
END
GOTO Main
'
[noparse][[/noparse] Subroutines ]
' Reads VRef and selected H48C axis through an MCP3204 ADC
' -- pass axis (0 - 2) in "axis"
' -- returns reference voltage counts in "rvCount"
' -- returns axis voltage counts in "axCounts"
Get_H48C:
· LOW CS
· SHIFTOUT Dio, Clk, MSBFIRST, [noparse][[/noparse]%11\2, VRef\3] ' select vref register
· SHIFTIN Dio, Clk, MSBPOST, [noparse][[/noparse]rvCount\13] ' read ref voltage counts
· HIGH CS
· PAUSE 1
· LOW CS
· SHIFTOUT Dio, Clk, MSBFIRST, [noparse][[/noparse]%11\2, axis\3] ' select axis
· SHIFTIN Dio, Clk, MSBPOST, [noparse][[/noparse]axCount\13] ' read axis voltage counts
· HIGH CS
RETURN
'
' Right-justify value in 5-digit field
' -- move cursor first, then call with value in "dValue"
RJ_Print:
LOOKDOWN dValue, >=[noparse][[/noparse]10000, 1000, 100, 10, 0], dPad
DEBUG REP " "\dPad, DEC dValue
RETURN

Comments

  • StomperStomper Posts: 5
    edited 2009-03-16 20:02
    My enail is Peaceful_Lost_Soul@yahoo.com pls reply......
  • Mike GreenMike Green Posts: 23,101
    edited 2009-03-16 20:10
    Download and read the documentation for PLX-DAQ. When you've gone through that, come back with specific questions.
  • StomperStomper Posts: 5
    edited 2009-03-16 20:22
    I've already done that.......
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-03-16 20:26
    Your duplicate post in the Propeller Forum has been removed.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Engineering
  • StomperStomper Posts: 5
    edited 2009-03-16 20:29
    UMMMMMM..........k so i can't basically connect it to a port, like what do i need to include in my program for the data that shows up in the debug window to go to the excel rows.......
  • sylvie369sylvie369 Posts: 1,622
    edited 2009-03-16 21:02
    Do you have the help file that comes with the PLX-DAQ download? It has some pretty detailed explanations and example. It should be all that you need.
  • StomperStomper Posts: 5
    edited 2009-03-24 06:52
    Ya it doesnt really help the help file.....
Sign In or Register to comment.