Shop OBEX P1 Docs P2 Docs Learn Events
Memory Stick Datalogger — Parallax Forums

Memory Stick Datalogger

CG_NSCC09CG_NSCC09 Posts: 4
edited 2009-12-15 02:21 in BASIC Stamp
Hey all,
I've recently purchased the USB Memory Stick Datalogger from parallax and was confused to a couple of aspects of the product. The first is what subroutines are required for it to begin logging(IE; check disk, clear datafile, recreate datafile, etc.). The second thing is how to get the USB Datalogger to publish the data I want to store into the thumb drive.

Information:
-Datasheet: http://www.parallax.com/Portals/0/Downloads/docs/prod/comm/MemoryStickDataloggerV1.1.pdf
-Demo Test: http://www.parallax.com/Portals/0/Downloads/docs/prod/comm/DataloggerDemoV1.0.zip
-Command Sheet: http://www.parallax.com/Portals/0/Downloads/docs/prod/comm/VDAPFirmwareSpec.pdf
-I have setup and ran the demo test flawlessly and was able to record and extract the information
-My purpose for the thumb drive is to log data for windspeed(variable labeled KPH), and wind direction(hall effect sensors using pins 0-7). My original plan was to include the writing to the thumb drive in the main programing so it publishes the data taken during the main routine(KPH and Direction).

Any help or direction is appreciated [noparse]:)[/noparse]
Thanks
Chris

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Gregory

Electronic Engineering Technician
NSCC - Pictou Campus - 2009
Contact me @ w0178285@nscc.ca

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-09 15:57
    The Demo Test program is pretty complete and does something like what you want. It sounds like you don't have to read the data back, so you wouldn't need the routine that reads from a file, but you'd need everything else (initialize the Datalogger, create a file, write information to the file, close the file). In the "Writing Data" portion of the program, you'd substitute your own SEROUT statement(s). Remember that the Datalogger requires that you supply a count of the number of bytes you want to write, so you'd need a fixed length format for your data like what's done in the demo program.

    What don't you understand?
  • SRLMSRLM Posts: 5,045
    edited 2009-12-09 17:51
    You may want to take a look at the code here. It isn't very clean, but it worked: http://forums.parallax.com/showthread.php?p=741023

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Powered by enthusiasm
  • CG_NSCC09CG_NSCC09 Posts: 4
    edited 2009-12-10 15:03
    Thanks for your help guys I trimmed down on my eeprom and figured out how to get the writing process to work!
    Now that I have everything wirtten down to a text file I plan to get some sort of conversion in there to change the direction value i have now(a numeric value) to some sort of special character saved to the thumb drive

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Gregory

    Electronic Engineering Technician
    NSCC - Pictou Campus - 2009
    Contact me @ w0178285@nscc.ca
  • CG_NSCC09CG_NSCC09 Posts: 4
    edited 2009-12-13 21:45
    Okay so ive been messing around with my code this weekend and when i try to serout to my datalogger anything but numeric values i get the square blocks in my text file.
    Ive tried to use ascii conversions, and ive tried to use special character data strings and pull them when I write, but im having no luck. Does anyone have any guidance for me or can point me in the right direction?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Gregory

    Electronic Engineering Technician
    NSCC - Pictou Campus - 2009
    Contact me @ w0178285@nscc.ca
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-13 21:48
    If you want help, you'll have to post your code. Use the Attachment Manager that appears when you use the Post Reply button (not the Quick Reply box).
  • CG_NSCC09CG_NSCC09 Posts: 4
    edited 2009-12-14 14:15
    · DEBUG "Opening Data File..."························· 'First Delete File
    · SEROUT TX\CTS, Baud, [noparse][[/noparse]$07, $20, "datafile.txt", CR]·· 'Datalogger command to delete file
    · GOSUB Get_Data······································· 'Purge Receive Buffer
    ······················································· 'Then Create File
    · SEROUT TX\CTS, Baud, [noparse][[/noparse]$09, $20, "datafile.txt", CR]·· 'Datalogger command to create file
    · GOSUB Get_Data······································· 'Purge Receive Buffer
    · DEBUG "Open!", CR, CR, "Writing Data...", CR········· 'Debug statement annoucning writing process
    · counter = counter + 1································ 'Sample Value
    ··· DEBUG "Sample ", DEC3 counter, " of ", DEC5 NumSamples,
    ········· " --> ", DEC3 windspeed, ",", DEC3 direction, CR'Display Results
    ··· SEROUT TX\CTS, Baud, [noparse][[/noparse]$08, $20, $00, $00, $00, $0D, CR,
    ········· DEC3 counter, ",", DEC3 windspeed, ",", DEC3 direction, CR, LF, CR]
    ··· PAUSE 500·········································· 'Write Results/Delay
    ··· GOSUB Get_Data··



    Right now I am using this to log our directional code, but I had to set the direction to a numeric value. This is good enough for us now in the testing phase but for the final logging procedure we would like it to record at least the letter values (N, NE, E, SE. etc) beside the logged sample and wind speed value

    We have tried to use ASCII values (78 for N, etc) and I also experimented with special characters but the block values showed up in the text data file.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Gregory

    Electronic Engineering Technician
    NSCC - Pictou Campus - 2009
    Contact me @ w0178285@nscc.ca
  • Mike GreenMike Green Posts: 23,101
    edited 2009-12-14 15:20
    Unfortunately, you've posted the code that works, but doesn't do what you want. You should be able to use the alphabetic compass directions. The only guess I can come up with for why it didn't work for you is that some of the directions are one letter and some are two letters and the text being written has a length value associated with it. You would need to either adjust the length or use a blank character for the 2nd letter to pad it out.
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2009-12-15 02:21
    Here is a snippet of code that might help with changing the direction to letters.

    azString  DATA  "N NEE SES SWW NW"   ' the azimuths, N, NE etc. as pairs, observe spaces
    aziText1 VAR Byte    ' two byte string to hold the current azimuth for debug or USB drive
    azText0 VAR Byte
    ' at this point have direction as an index from 1 to 8
    READ (direction -1)*2 + azString, azText1, azText0   ' reads the azimuth text data
    DEBUG DEC3 direction, " ", STR aziText1\2
    



    This assumes that the variable "direction" contains a value from 1 to 8 for the 8 points of the compass. I gather that from what you said about the 7 Hall effect switches and from the "Get_direction subroutine in your program. The index then is used to look up two characters, and then the STR modifier sends those two characters to the screen (or similarly to the USB drive).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
Sign In or Register to comment.