Shop OBEX P1 Docs P2 Docs Learn Events
RE: problem to save the data more than 4KB — Parallax Forums

RE: problem to save the data more than 4KB

MaheshMahesh Posts: 11
edited 2013-05-22 05:33 in BASIC Stamp
Dear Sir/Madam,

I bought this following link product.
http://www.parallax.com/StoreSearchR...4/Default.aspx.
I am working with AVR micro-controller which is used to communicate in UART MODE with memory stick data logger,
the communication is perfect with the micro controller and data logger, i can able to save the data also in some formats (.txt, .csv etc.,)
but,I am unable to save the data more than 4 KB in Pen drive (Kingston 128MB) using this data logger.
I was tried to save the data in different formats (.txt, .csv., etc.,) to get a more than 4 KB of data in Pen drive .
i was also tried with different pen drive but where could be the issue i am unable to understand...

I will be great thankful to any one help...

Kindly Regards,
Mahesh

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-16 06:02
    The memory stick datalogger works for all sorts of file sizes, up to GB. What error are you getting? What commands are you sending to the datalogger? How and when does the error occur?
  • MaheshMahesh Posts: 11
    edited 2013-05-16 21:59
    Dear sir,

    thanks for responding...
    I am saving the data in data logger as per following code.
    Save_data_datalogger(){


    USART_Transmit(0x0D); // This will return the appropriate prompt or no disk message for the current command set.
    for(i = 0 ; i < 20 ; i++);
    USART_Transmit(0x0D); // This will return the appropriate prompt or no disk message for the current command set.
    for(i = 0 ; i < 20 ; i++);
    SendString("IPA"); // This command is used to give the input of ASCII format
    for(i = 0 ; i < 20 ; i++);
    USART_Transmit(0x0D);
    for(i = 0 ; i < 20 ; i++);
    SendString("OPW Test.csv"); // This will Opens a file for writing to with ‘WRF’
    for(i = 0 ; i < 20 ; i++);
    USART_Transmit(0x0D);
    for(i = 0 ; i < 20 ; i++);
    SendString("WRF "); // This command is used for Writes the data of <size in hex(4 bytes) > to the end of the current open file.
    for(i = 0 ; i < 20 ; i++);
    USART_Transmit(2);
    for(i = 0 ; i < 20 ; i++);
    USART_Transmit(0x0D);// transmitting the data in HEX format
    count = 0 ;
    SendString("a"); // transmitting the string using UART
    for (i = 0 ;i < 20 ; i ++);
    SendString("b");
    for (i = 0 ;i < 20 ; i ++);
    SendString("B");
    for (i = 0 ;i < 20 ; i ++);
    USART_Transmit(0x0D);
    SendString("CLF Test.csv"); // This will be closes the Test.csv file
    for(int i = 0 ; i < 20 ; i++);
    USART_Transmit(0x0D);


    }
    please go through this code and kindly suggest me if there are any mistakes.
    i could seen only one error that has when we are sending the data red light should blink continuously but suddenly stops blinking after saving more than 4KB in data logger .
    i was observed that the data logger should send "D:\" as response but i had seen only "D" as a response.
    one important thing is, it is not responding for any command after getting this error.
    i relly do not know why it is sending wrong response.
    dear sir, can you please send me any working code?
    i would try that code.


    Thanks and Regards,
    mahesh
  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-16 22:09
    After the WRF command, you have to send the size of the data as 4 bytes, most significant byte first, not a single byte as you've done, probably something like:

    USART_Transmit(0);
    USART_Transmit(0);
    USART_Transmit(0);
    USART_Transmit(2);

    This would set a length of two bytes for the data. I note that you're actually trying to send 4 bytes ("abB\r") and the count would have to reflect that. Please re-read the description of the various commands paying particular attention to the few examples provided. I know the manual is not the clearest in the world, but it's what there is.
  • MaheshMahesh Posts: 11
    edited 2013-05-17 00:11
    Dear sir,

    I have tried as per your concern but i do not get any change.
    same issue is getting repeated. could you please suggest me any thing else to do ? how to check the data logger whether saving the data more than 4KB or not ?


    BR,
    Mahesh
  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-17 07:16
    There is plenty of sample code, but not for the AVR microprocessor. As with all Parallax products, there are links to sample code for the Stamps and for the Propeller on the product page on the right side about 1/2 way down (see here). I suggest taking one of the examples and trying to translate it for the AVR. As I mentioned, the datalogger works. There are people who have written huge files and lots of files, all larger than 4KB. Most problems have to do with writing commands improperly, like getting these record sizes wrong. Unfortunately, you have to know exactly how much you need to write (or read) and specify that ahead of time in the command. The length (size) fields are 32-bit binary values.

    In terms of checking whether the data is written correctly, you'll just have to write a program, probably for the PC in something like Visual Basic that will dump the file in some readable form that you can use for debugging.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2013-05-17 13:03
    I almost replied to this post yesterday but I didn't really have any help to suggest.

    I will say I use my memory stick data logger frequently and I have several .txt log files files as large as 6 KB.

    Sorry I don't know enough AVR programming to help.
  • MaheshMahesh Posts: 11
    edited 2013-05-20 02:17
    Dear Sir,

    Thanks for fast responding.
    I was too tried with different ways finally, I was changed the delay after closing of file.
    so that i can able to save the data without any issues.
    Really thanks for your supporting...
    your precious helps me a lot..

    now i will recommend this to use easily and with extreme technical support..


    BR,
    Mahesh
  • MaheshMahesh Posts: 11
    edited 2013-05-22 00:23
    Dear sir,

    could you please send me the link of samples codes to save the data in data logger

    Best Regards.
    mahesh
  • Mike GreenMike Green Posts: 23,101
    edited 2013-05-22 05:33
    Whenever you want sample code for a Parallax product, look on the product webpage in their webstore. There will be links to documentation and to sample code, usually about 1/2 way down the page on the right side. For the memory stick datalogger, see here.
Sign In or Register to comment.