Shop OBEX P1 Docs P2 Docs Learn Events
Saving and Displaying High and Low PSI Readings — Parallax Forums

Saving and Displaying High and Low PSI Readings

GuidoGuido Posts: 195
edited 2007-06-01 21:27 in BASIC Stamp
·I am trying to save high and low PSI readings. I have tried everything including this and both High and Low display the same reading as the current reading. Any Help would be appreciated....The rest of the program is solid, just trying to document the low and High readings seems to be the trouble


SELECT·PSI
·· CASE >HPSI
···· ADDR = 170
··· GOSUB Save
····HPSI =·PSI
·· CASE <LPSI
···· ADDR = 150
··· GOSUB Save
····LPSI =·PSI
· ENDSELECT
· RETURN

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-31 15:11
    Guido,

    Something simple to give you an example.

    IF PSI > HPSI THEN HPSI = PSI
    IF PSI < LPSI THEN LPSI = PSI

    Put this in your loop where you’re checking the PSI and it will keep those variables updated. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • GuidoGuido Posts: 195
    edited 2007-05-31 20:35
    Chris,
    Thank You I have played with this before, But the problem I am having is I need to write it to memory with a time stamp. If I did the following:

    IF PSI > HPSI THEN H
    IF PSI < LPSI THEN LLPSI = PSI

    H:
    HHPSI = PSI
    ADDR=40
    GOSUB SAVE· ' WRITE INFO
    RETURN

    L:
    LPSI = PSI
    ADDR=50
    GOSUB SAVE· ' WRITE INFO
    RETURN

    IT DOES NOT LIKE THE THEN H OR L
  • sam_sam_samsam_sam_sam Posts: 2,286
    edited 2007-05-31 20:44
    Guido

    IT DOES NOT LIKE THE THEN H OR L

    IF PSI > HPSI THEN H




    Some time when it give trouble like that i just try this


    IF PSI > HPSI THEN
    GOTO ·H
    ENDIF

    ·I do not know if this will work or not
    I·have no way of trying this out to tell you if it will work or not



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ··Thanks for any·idea.gif·that you may have and all of your time finding them

    ·
    ·
    ·
    ·
    Sam
  • GuidoGuido Posts: 195
    edited 2007-05-31 20:53
    No,
    I tried that as well. Doind it that way it will change the PSI readings on both High and Low with current PSI readings. Frustrating something that is so simple gets confusing
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-05-31 21:03
    IF PSI > HPSI THEN
      HPSI = PSI
      WRITE 0, HPSI
    ELSEIF PSI < LPSI THEN
      LPSI = PSI
      WRITE 1, LPSI
    ENDIF
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • LSBLSB Posts: 175
    edited 2007-05-31 21:16
    Then:

    IF PSI > HPSI THEN
    HPSI = PSI
    ADDR=40
    GOSUB SAVE ' WRITE INFO
    End If

    IF PSI < LPSI THEN
    LPSI=PSI
    ADDR=50
    GOSUB SAVE ' WRITE INFO
    End If
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-06-01 14:08
    LSB,

    You could do that too. Of course that saves code if you’re doing a lot of writes to various EEPROM locations. I didn’t know what was in the Save routine so I just did it as I would have assuming address 0 and 1 were available. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • GuidoGuido Posts: 195
    edited 2007-06-01 21:27
    Chris, LSB,

    Thanks you both very much! I did get it working with LSB version, Your code for the Low pressure just would read 1......Why is it so hard to do a simple < or > then? And yes Chris, I am Monitoring 8 sensors for a couple of months....Should only write when needed and time stamp to go along with the proccess'

    Thanks Again

    Guido
Sign In or Register to comment.