We all know that our Campbell Scientific dataloggers are really good at taking measurements and storing data. But did you know that they can also make decisions and control other devices? It's true! Déjà vu! www.campbellsci.com/tips-decisions. While this is all still applicable and will continue to work in your datalogger, I’m going to tell you about a new instruction, TimeIsBetween(). It is being introduced with the release of OS 28 for the CR3000, CR1000, and CR800 series along with OS 01 in the CR6.

TimeIsBetween() returns TRUE if the datalogger's real-time clock falls within the specified range; otherwise, the function returns FALSE. Like the TimeIntoInterval() instruction, we often embed it in an if/then logic statement.

     If TimeIsBetween (0,10,60,Min) Then
(1) ' Turn phone on. 
(0) 'Turn phone off.

TimeIsBetween() returns TRUE for the entire interval specified, whereas TimeIntoInterval() returns TRUE only for the one scan that matches the interval specified.  

For example: if you sent a program to the datalogger at one minute past the hour, the TimeIsBetween() instruction, using the program snippet, would evaluate as TRUE on its first scan. The TimeIntoInterval() instruction, using the program snippet below, would evaluate as TRUE at the top of the following hour, 59 minutes later.

     If TimeIntoInterval ( 0,60,Min) Then PortSet (9,1) 'Port “9” is the SW12V Port. Turn phone on.
     If TimeIntoInterval (10,60,Min) Then PortSet (9,0) 'Turn phone off.

Note:  BeginTime is inclusive and EndTime is exclusive in the range of time that will return a TRUE result. For example: TimeIsBetween(0,10,60,Min) will return TRUE at 8:00:00.00 and FALSE at 08:10:00.00. 

See you next time. . . .

We're active on Social Media!
Stay informed with our latest updates by following us on these platforms: