Shop OBEX P1 Docs P2 Docs Learn Events
Applied Sensors (Tracy Allen). — Parallax Forums

Applied Sensors (Tracy Allen).

MichelBMichelB Posts: 154
edited 2009-08-24 07:19 in Accessories
Page 113, "Wouldn't it be nice to have the data logger press the button for you, ...". Yes indeed, very interesting, it work very well. Is it possible to add a line as it follows: "Enter interval needed in seconds". If possible, how to do it? Thank you in advance and best regards.

P.S.: If a value > 255 for n (i.e. more than 255 seconds interval) is entered the "timer" does not work!
Please find herewith attached the code, only the display of light has been modified, light * 2 instead of light.

Post Edited (MichelB) : 8/21/2009 1:41:44 PM GMT

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-08-21 16:57
    bonjour Michel,

    Before the DO:LOOP add,
    n  VAR Word  ' <---- this is Word instead of Byte so the interval can be > 255 seconds
    n0 VAR Word ' <---- this will be your selected interval
    
    DEBUG CR,"Enter interval needed in seconds: "
    DEBUGIN DEC n0
    n0 = n0 MIN 1   ' <---- don't allow zero
    


    and inside the DO:LOOP change one line:
    LOOP UNTIL (n=n0 OR IN1=0)      ' Get data at "n0" second intervals, or on button.
    



    Does that make sense?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • MichelBMichelB Posts: 154
    edited 2009-08-22 07:35
    Merci beaucoup, thank you very much Tracy.

    P.S.: After modification the program does not run due to the fact that there is not enough space for variable, maybe I must reduce number of records? Would you like to try and modify the attached code?

    P.S.2: Very sorry for disturbance, in "RAMDataLogger.bs2", Interval· CON· 10, when CON > 255 program does not run. I suppose not enough space in RAM for this constant.

    Post Edited (MichelB) : 8/22/2009 4:28:03 PM GMT
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-08-22 16:18
    Bonsoir,
    Ahhh. One way to free up variable space would be to decrease the size of the data log file, now 18 bytes. Another way would be to move the data log file into the eeprom and thus free up 18 bytes of RAM. Another way is to recycle variables.

    The third way first. Change the variable declarations to,
    ' -----[noparse][[/noparse] Declarations ]----------------------------------------------------
    log       VAR        BYTE(18)     ' 18 bytes reserved for the log file.
    rct       VAR        WORD         ' Variable for RCTIME.
    light     VAR        rct         ' Variable light intensity.   <---- alias light to rct
    TC        VAR        WORD         ' Variable for degrees Celsius from AD592.
    n         VAR        rct         ' Counter for the pushbutton.  <---- alias n to rct
    n0        VAR        WORD         ' Counter for interval in seconds.
    ptr       VAR        BYTE         ' Pointer to next entry in data log file.
    



    You see, the variable rct is being recycled twice with aliases n and light, and I think you will find that there is no conflict when using that same memory word location for the three different meanings. The program now uses 25 bytes of RAM (one byte remains free).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • MichelBMichelB Posts: 154
    edited 2009-08-23 09:53
    Bonjour Tracy, in Applied Sensors\RAMDataLogger.bs2\Interval· CON· 10, "you can choose whatever interval you need" I got similar problem as previously with variables space i.e. that if CON > 255 program does not run. I suppose that a constant is similar than a variable. Sorry for disturbance, thank you in advance and best regards.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2009-08-24 04:40
    The program uses all 26 bytes, 13 words of the Stamp BS2 RAM. And since this program adds one more sensor (conductivity) to the mix, it is already using alias names for variables. Another way to increase the logging interval is to make it units of, say, 10 seconds or 1 minute, instead of 1 second limited to 255 seconds. It would not be very accurate as implemented, but making it one minute would get you out to 4 hours between samples for 6 samples of all the variables in 24 hours.

    The best solution is to store the log file in the eeprom instead of in the RAM. Then of course it would no longer be a RAMDataLogger, but that would free up 18 bytes for expansion in other directions.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • MichelBMichelB Posts: 154
    edited 2009-08-24 07:19
    Thank you Tracy.
Sign In or Register to comment.