Shop OBEX P1 Docs P2 Docs Learn Events
datalogger issue — Parallax Forums

datalogger issue

PDC_NSCC12PDC_NSCC12 Posts: 2
edited 2013-01-23 09:03 in BASIC Stamp
I am working on school project that is using a bs2 and a parallax datalogger. we are monitoring temp changes and wanting to log these changes (there are other components to our project) with the code I've put together my temp is reading properly and the logger is sampling however with the data file that is output it is missing every second reading. I'm not wanting for someone to give me the "fixed" code but I am hoping someone can point me in the right direction. This is my first post here so hopefully I've added things the right way. I think I've supplied the code and the resultant datafile. Any help would be great. Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-01-17 08:37
    The problem you're running into is that the datalogger expects a fixed length record when you write to it (or read from it). Your SEROUT statement for the write gives a byte count of $0D (=13), but you don't supply that number of bytes. The datalogger is still expecting more and, when you write the second reading to it, it gobbles part of that information as the end of the previous record and ignores the rest. An easy fix is to force the data to be of fixed length. Instead of DEC, use DEC5 which always produces a 5 digit value. The SEROUT would look like (note the change in the length byte):

    SEROUT TX, Baud, 100, [$08, $20, $00, $00, $00, $07, CR, DEC5 tC , CR, LF, CR]
  • PDC_NSCC12PDC_NSCC12 Posts: 2
    edited 2013-01-18 07:20
    Thanks for the input Mike. I made the change but the result is still the same only now i have 2 zeros in front of my values but I am still not getting the second sample. no carriage return after second sample and no value, just a little "box" is displayed and then the 3rd sample as it should be. Still lost on this one... to me it seems like its a timing issue. it seems to me that the time it takes my temp chip to pull the reading the write function has already moved on and "skips" that input. But I'm unsure how or why???
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2013-01-23 09:03
    Can you attach the revised code and another example of the output for comparison?
Sign In or Register to comment.