Saving and Displaying High and Low PSI Readings
Guido
Posts: 195
·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
SELECT·PSI
·· CASE >HPSI
···· ADDR = 170
··· GOSUB Save
····HPSI =·PSI
·· CASE <LPSI
···· ADDR = 150
··· GOSUB Save
····LPSI =·PSI
· ENDSELECT
· RETURN
Comments
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
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
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··that you may have and all of your time finding them
·
·
·
·
Sam
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 Savage
Parallax Tech Support
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
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
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