Trying to use the GPS to set a clock on a CR1000. In the help is says that the "TimeOffset" is type "Constant or variable". I used a variable for that parameter and the CRBasic compiler (30.01) gives an error saying "Variable illegal in Parameter". Is the help wrong or is the compiler wrong?
Kyle,
Looking at the source code for the GPS() instruction, TimeOffset has to be a constant.
We will update the help to reflect this.
Thanks.
Thanks Gary.
That being said, I am looking for a way to only allow the GPS function to set the clock conditionally (when a boolean goes high). It appears the GPS function executes the clock set (with a negated comm port) in the background and GPS can not be used in a conditional statement. I tried to use the GPS function with negated comm port before the scan and it appears that once it sees the GPS function once, it will continually try to keep the clock in sync. With the exception of parsing the GPS data and using a ClockSet function myself, is there anything else I can do?
We could not come up with solution for you. We have passed your question on to Research and Development to see if we can find you a answer. We will get back to you soon.
From Research and Development:
You can make the MaxTimeDrift a variable. Set the default value to -1 (this will disable setting time). When you want to change time, set the MaxTimeDrift to a small value. After the time is set, change the value back to -1.
Great! Tell them thanks for the answer. And thank you Gary for tracking that down!