I have a routine that is incrementing or decrementing 1 time each pass. It reads a milibar value(dec_mb) every second. Then it compares this to the last reading(last_mb) to see if it is going up or down. The value inc_mb then holds a cumulative value, but it can be negative.... After 10 loops it trys to tell me what the trend is - it does not work, and my Inc_mb which should be a value of -10 to 10 shows '255' which must mean a negative number breaks PBP??
So I can see an average move over 10 seconds, I wrote the following:
if Dec_mb > last_mb then
inc_mb=inc_mb+1
endif
if Dec_mb < last_mb then
inc_mb=inc_mb-1
endif
mb_count = mb_count+1
if mb_count > 10 then
if inc_mb >= 6 then
LCDout " R+",#inc_mb
endif
if inc_mb > 2 and inc_mb < 6 then
LCDout " R ",#inc_mb
endif
if inc_mb > -2 and inc_mb <= 2 then
LCDout " S ",#inc_mb
endif
if inc_mb <= -2 and inc_mb >= -6 then
LCDout " F ",#inc_mb
endif
if inc_mb < -6 then
LCDout " F+",#inc_mb
endif
It always tells me it is 'F+', even when the value is '0'.. it should be telling me 'S' there..
Arggghhh..
Bookmarks