Shop OBEX P1 Docs P2 Docs Learn Events
How to store datas in the data logger....desesperate! — Parallax Forums

How to store datas in the data logger....desesperate!

BERTARHBERTARH Posts: 3
edited 2010-01-25 16:42 in Learn with BlocklyProp
Hello! I am actually working with the BASIC STAMP 2px to control a gyroscope....We decided to add the data logger to store the data, but my problem is that I don't know how to do it....I have conected the dataLogger to the basic stamp and I have tried to run the test code, but it stops in the "Syncronizing" message and don't give me any other message.....I don't know why could it be....Could someone help me? I am desesperate with it!! Thanks!

Comments

  • SRLMSRLM Posts: 5,045
    edited 2010-01-13 21:46
    You need to change some of the constants in the code, since you aren't using a BS2 (which the test code was written for). Specifically, you'll want to take a look at the SEROUT and SERIN baud rates and change the numbers. Look up the commands in the BS2 manual for an example of what to change the numbers to.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Powered by enthusiasm
  • LuckyLucky Posts: 98
    edited 2010-01-19 07:40
    Have you looked at the example programs on the data logger product page? This is the only line in the example program that I see that needs to be changed"

    "Baud CON 84 ' Serial Baud Rate 9600 bps (BS2)"

    I don't know what the new value for the 2px should be though...
    Should be easy to find out

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "You do not really understand something unless you can explain it to your grandmother."


    -Lucky[size=-1][/size]
  • BRH7BRH7 Posts: 6
    edited 2010-01-21 20:19
    Thanks, I have change the Baud rate to 9600 (CON 396) and it works, but now my problem is that I need to strore datas at a higher speer, so I think I would need to use a Baud rate of 19200 (CON 188)...It works with the basic stamp but not with the data logger....I have read taht it's because the data logger has a default baud rate of 9600 and you have to configurate it if you want to change it, but I dont know how to do it.....could someone help me??
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-21 20:37
    There's a Set Baud Rate command ("SBD") described in the VDAP Firmware Spec available from Parallax and Vinculum (the manufacturer). You can change the Baud setting with this command. Keep in mind that the Stamps (other than the BS2px) don't work well at 19.2KBaud, particularly when receiving data. SPI mode could work with a Stamp and doesn't require the SBD command. Unfortunately, the only sample code is for the Propeller, not the Stamps. The full VDAP Firmware Manual available from Vinculum goes into SPI mode in more detail.
  • BRH7BRH7 Posts: 6
    edited 2010-01-25 15:28
    I have been reading this document but I still dont know how to do it....Should I use the Basic Stamp editor or I have to do it with the command window?...Thanks for the help, I am really lost in this point
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-25 15:50
    Given your level of expertise, I think that you should look for other solutions to your problem. Stick with 9600 Baud which works for you. Focus on how you can change the amount of data you're logging. You didn't say what you're actually logging, but you may be able to trim the number of bytes used, thus increasing the logging rate. How about describing your project in more detail?
  • MSDTechMSDTech Posts: 342
    edited 2010-01-25 15:55
    I've had very good luck using SPI mode with the data logger and a BS2px. With serial communications, it is possible to miss a transfer from the data logger, which can cause unexpected results.

    The essential components are:

    1. The four pin definitions for Chip Select (USBCS) Data In (USBDataIn)·Data Out (USBDataOut) and·SPI Clock (USBClk).

    2. Two preable constats for·writing and reading:
    USBPre_W····· CON·· %100
    USBPre_R····· CON·· %110

    3. The two subroutines to read/write a byte from the device:
    USB_Write:
    · HIGH USBCS
    · SHIFTOUT· USBDataOut, USBClk, MSBPOST, [noparse][[/noparse]USBPre_W\3, IoByte\8]
    · SHIFTIN·· USBDataIn, USBClk, MSBPOST, [noparse][[/noparse]Status\1]
    · LOW USBCS
    · PAUSE 1
    RETURN

    USB_Read:
    · HIGH USBCS
    · SHIFTOUT· USBDataOut, USBClk, MSBPOST, [noparse][[/noparse]USBPre_R\3]
    · SHIFTIN·· USBDataIn, USBClk, MSBPOST, [noparse][[/noparse]IoByte\8, Status\1]
    · LOW USBCS
    · PAUSE 1
    RETURN
  • BRH7BRH7 Posts: 6
    edited 2010-01-25 16:28
    My project consist in using a mocrocontroller for a gyroscope...The idea is that we can control 4 or 5 gyroscopes and store the data. They tld me that we would need torecord data at 100 hz or more (that is about 6000 samples per minute),and actually I only can record 3000....That's why I need to change the baud rate. I have never worked with robotic and I am doing my thesis abroad, so it's being a little difficult for me... I tought that changing the PAUSE value I would be able to record data as a higher speed, but I cant....We need higher frequency because we need to caracterize the movement, and the number of samples I am getting now wont be enough.....But I have no idea how to change the baud rate and all the manuals are in english too...
  • BRH7BRH7 Posts: 6
    edited 2010-01-25 16:42
    My actual code is

    ' {$STAMP BS2px}
    ' {$PBASIC 2.5}
    'Programa de prueba para escribir los datos del giroscopo en el data logger
    '
    '
    I/O Definitions

    TX PIN 1 ' Transmit Data --> 27937.4 (RXD)
    RTS PIN 2 ' Request To Send --> 27937.6 (CTS)
    RX PIN 3 ' Receive Data <-- 27937.5 (TXD)
    CTS PIN 4 ' Clear To Send <-- 27937.2 (RTS)


    '

    '
    Constants

    Baud CON 396

    '

    '
    Variables

    value VAR Byte
    cont VAR Word
    cont2 VAR Word

    '

    '
    Inicialization

    DEBUG CLS, "Program to record data and store it on a data logger", CR, CR
    PAUSE 2000 ' Allow Time To Settle

    HIGH TX ' Initialize Transmit Line
    LOW RTS ' Take Vinculum Out Of Reset

    PAUSE 2000 ' Allow Time To Settle

    ' Delete SEEDFILE.TXT if one exists, ignore error if no file exists
    PAUSE 500
    SEROUT TX\CTS, Baud, [noparse][[/noparse]"DLF seedfile.txt", CR]



    SEROUT TX\CTS, Baud, [noparse][[/noparse]"OPW seedfile.txt", CR]

    FOR CONT2 = 0 TO 50


    FOR CONT = 0 TO 1500



    LOW 12
    SHIFTIN 9, 11, MSBPOST, [noparse][[/noparse]value\9]
    HIGH 12

    WRITE cont, value


    DEBUG DEC5 value



    SEROUT TX\CTS, Baud, [noparse][[/noparse]"WRF ", $00, $00, $00, $07, CR, DEC5 value, CR, LF, CR]

    NEXT

    NEXT


    SEROUT TX\CTS, Baud, [noparse][[/noparse]"CLF seedfile.txt", CR]
    DEBUG "CLOSED"
    END



    How could I use the trim???Or would it work with the SPI mode?...Thank you so much!!!sooo much!!
Sign In or Register to comment.