bonehead pbasic 2.5 question
Taylortronic
Posts: 20
hello, stamp programmers,
i am currently working on a datalogging/relay control project that performs logging operations every minute.· this time-based reporting has me just a little hung up.· i am new at the pbasic·but i'm sure there is a more elegant way to launch a subprogram when the minute changes than the clunky method that i'm using.
right now, my program uses a variable that is defined as minutes and another called minutewatcher.· minutewatcher·= minutes+1.· i've also inserted an "IF minutewatcher = minutes THEN..." exit out of the loop that the program runs through the duration of the current minute.· the minutes variable catches up to the minutewatcher variable when the minute changes and then after the datalogging subprogram minutewatcher is refreshed as minutes + 1 and returns to the original loop.
i am absolutely convinced that this is caveman programming.· it costs me a variable, and it's linear (only checks the minutes at one point in the loop instead of consistently while monitoring sensors) and i'm sure there is a cooler way to go.· does anybody know a command or technique to launch a subprogram when a time variable changes?
looking for an emoticon that checks his watch,
taylortronic
i am currently working on a datalogging/relay control project that performs logging operations every minute.· this time-based reporting has me just a little hung up.· i am new at the pbasic·but i'm sure there is a more elegant way to launch a subprogram when the minute changes than the clunky method that i'm using.
right now, my program uses a variable that is defined as minutes and another called minutewatcher.· minutewatcher·= minutes+1.· i've also inserted an "IF minutewatcher = minutes THEN..." exit out of the loop that the program runs through the duration of the current minute.· the minutes variable catches up to the minutewatcher variable when the minute changes and then after the datalogging subprogram minutewatcher is refreshed as minutes + 1 and returns to the original loop.
i am absolutely convinced that this is caveman programming.· it costs me a variable, and it's linear (only checks the minutes at one point in the loop instead of consistently while monitoring sensors) and i'm sure there is a cooler way to go.· does anybody know a command or technique to launch a subprogram when a time variable changes?
looking for an emoticon that checks his watch,
taylortronic
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I think you are on the right track, too. It may be that you don''t need to use a whole byte for this, when one bit would do. One bit can track it, as it rolls from even to odd to even.....
I don't understand what your are getting at with this statement, "and it's linear (only checks the minutes at one point in the loop instead of consistently while monitoring sensors)".
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
anyway, if this is the technique you guys would use, i'm certain it's the right way to go.
once again, this forum has made the path clear for me and i really appreciate it.
sincerely,
taylortronic