Our full technical support staff does not monitor this forum. If you need assistance from a member of our staff, please submit your question from the Ask a Question page.

Log in or register to post/reply in the forum.

control SW12-1 on CR1000X

fdeclercq Sep 18, 2019 01:04 AM

Dear All i have purchase a new CR1000X and i have a problem with my code

in fact i work with Cr1000, c3000 or c850 and i control my com111 modem with the port SW12 to reduce the consumption of energy of my battery

the problem i have is the following : on my old logger i use the instruction Portset like follow to control the port and it work well

Public RTime(9)
' (1) year, (2) month, (3) day of month, (4) hour of day, (5) minutes,
'(6) seconds, (7) microseconds, (8) day of week (1-7; Sunday = 1), (9) day of year.

'Main Program
PortSet (9,1 ) ' turn SW12 on when program is sent to logger
Scan (1,Sec,0,0)

RealTime (RTime())
'To turn SW12 off then on ten minutes later once a day at midnight:
If TimeIntoInterval (0,1440,Min) Then PortSet (9,0 ) ' turn SW12 off
If TimeIntoInterval (10,1440,Min) Then PortSet (9,1 ) ' turn SW12 on

But on the CR1000X this code doesn't work.

i have try the instruction SW12 but the port is continuously on power.

Do you have an idea to miodify my code to having the same function than the old logger?


JDavis Sep 18, 2019 10:40 AM

Try this line:


SW12 (SW12_1,TimeIsBetween (0,10,1440,min) ,1)


This one line will replace the three lines from your program. The TimeIsBetween instruction was added primarily to simplify code for this use case.

fdeclercq Sep 19, 2019 03:26 AM

perfect! regards

fdeclercq Sep 20, 2019 01:51 AM

Dear Jdavis

i have try your code, the port is powered but continuously, i have'nt find a solution to indicate an interval of power. do you have a solution?


GeodeNZ Sep 22, 2019 10:34 AM

fdeclercq, your original code appears to turn the modem off at midnight,  then turns it back on ten minutes later. With those instructions your modem will be powered on for all but ten minutes per day.

Are you wanting to have the modem on for only ten minutes starting at midnight? If so, one version would like this.

If TimeIntoInterval (0,1440,Min) Then PortSet (9,1 ) ' turn SW12 on
If TimeIntoInterval (10,1440,Min) Then PortSet (9,0 ) ' turn SW12 off

Keep in mind that the switched 12 won't shut off until the first time it hits 10 minutes past midnight after the program is sent, or restarted do to the instruction between beginprog & scan


fdeclercq Sep 23, 2019 12:18 AM

Dear GeodeNZ

this is an exemple but on the reality i want the modem turn on at 440min and turn off at 720min.

on the new cr1000X the portset instruction doesn't work.

Did you have an idea?


GeodeNZ Sep 23, 2019 05:36 AM


Not tested, but give this a try

SW12 (SW12_1,TimeIsBetween (440,720,1440,min) ,1)

Log in or register to post/reply in the forum.