Light on and off by time clock.

siafu

Active Member
Hello all,
 
I wanted to add additional program lines to the below code that I have in one of my older Webcontrol board. Version: v03.01.03
 
I tried so many different combinations but it will not work.
 
Basically, I wanted to add to my existing code (listed below in green) code that will tun on OP3 at 4:00 and then turn off OP3 at 23:00, also wanted to have one email sent when it goes on and off.
 
Can someone help me with integrating the above into the below?
 
Thank you very much.
 
 
 
START    
TSTLT AIP1 8  
SET OP1 1  
TSTGT AIP1 12  
SET OP1 0  
TSTLT T3 1080  
SET OP2 1  
TSTGT T3 1160  
SET OP2 0  
XOR OP1 VAR1  
BZ  TEMPTEST  
TSTEQ OP1 1  
EMAIL 1   
TSTEQ OP1 0  
EMAIL 2   
 
TEMPTEST:
XOR OP2 VAR2  
BZ  DONE  
TSTEQ OP2 1  
EMAIL 3   
TSTEQ OP2 0  
EMAIL 4   
 
DONE:
SET VAR1 OP1  
SET VAR2 OP2  
END  
 
You need to update firmware.  Firmware version 3.x.y means that is PLC firmware. 3.1.y means that was firmware for older 2.0.2 hardware.  3.1.03 is a very early version of the firmware, does not support a lot of newer commands.  It also does not support bootloader, so its update must be done by sending it back.
 
I don't have all the manuals for early versions of the PLC code but I think even that version supports timer and email.
 
Here is a fragment of code I use to send morning and evening email from our greenhouse, main purpose is to report min/max temperature over the previous 12 hours. Very similar to what you are trying to do:
**********************
EMSTATUS:
    TSTEQ    VAR8 0
    GOTO    NEWMINMAX
    TSTEQ    VAR8 1001
    GOTO    LOGGER    
    DEC    VAR8
    RET

NEWMINMAX:
    SET    VAR8 1001    
    SET    VAR4 T2
    SET    VAR5 T2
    SET    VAR1 0
    RET

LOGGER:
    TSTGT    T2 VAR4
    SET    VAR4 T2
    TSTLT    T2 VAR5
    SET     VAR5 T2
    TSTEQ    CH 6
    GOTO    MORNMAIL
    TSTEQ    CH 18
    GOTO    EVENMAIL    
    RET

MORNMAIL:
    TSTEQ    VAR6 18
    RET

    EMAIL    EM7
    SET    VAR6 18
    SET    VAR8 1000
    RET    

EVENMAIL:
    TSTEQ    VAR6 6
    RET

    EMAIL    EM8
    SET    VAR6 6
    SET    VAR8 1000
    RET

**********************************
VAR6 is used to set when the next email is sent. Code checks current hour and when it matches sends email and updates VAR6 to time for next email.
VAR8 is used to delay 10 seconds before updating VAR4/5 with new min/max temp. Email is not sent right away - if you are changing information you want reported in the email need to give the previous email enough time to be sent. Otherwise email will report new values, rather then old ones.
 
 
But as support mentioned they have added a lot of new features so if you can afford to take your unit out of service to be upgraded that would be useful.
 
Hello,
 
I wanted to confirm, that with my current version of webcontrol board Version: v03.01.03 is no capable of running the below?
 
TSTGE CH 19 RAM2
NOP
TSTLE CH 5 RAM3
NOP
OR RAM2 RAM3 OP3
RET
 
I could not find you exact version of the FW on the CAI site but the previous one: 3.01.00 supports RTC and testing hours. If you paste in your code and WebControl does not complain it understands the commands, if not it will flag an error. The big difference with early FW is how email is processed. That should not affect what you are trying to do.
http://cainetworks.com/manuals/webcontrol/WebControlPLCUserGuide3-01-00.pdf
 
The code fragment you posted does nothing due the the NOPs after each test.
 
The code segment I posted is pretty close to what you want to do, just modify it to suit your needs.
 
Not quite what you wanted, but I have a weatherstation with forced-aspiration. The fan turns on at 4am and off at 10pm.
It doesn't send email, it just works....  (fan is on OP8)
 
 

START    
    TSTGE CH 4 VAR1
    TSTGT CH 21  
    SET VAR1 0  
    SET OP8 VAR1  
    END    
 
If you wanted to send an email when it changed states (I haven't tried this as I have no interest, but it should work)
 

START    
    TSTGE CH 4 VAR1
    TSTGT CH 21  
    SET VAR1 0  
    TSTNE VAR1 OP8
    EMAIL  EM1
    SET OP8 VAR1  
    END

 
Or, perhaps if you wanted an email when it turned on, and a different one when it turns off:
 
 

Code:
START    
LOOP:
   TSTGE CH 4 VAR1
    TSTGT CH 21  
    SET VAR1 0  
    TSTEQ VAR1 OP8
    GOTO LOOP
    SET OP8 VAR1 
    TSTEQ VAR1 1
    EMAIL  EM1
    TSTEQ VAR1 0
    EMAIL EM2
    END
 
I figured it out after many hours of testing.
 
On my board I need to use CT Current Time, command. and the times have to be in this format 00:00:00, strange.
 
So this is my setup so far, The green is the new code, and the black is what I had before. I'm not sure it the old code will work, will have to see in the morning when the lights are to be turned off, and see if the water heater tank sends emails about temps.
 
START    
LOOP:
    TSTGE CT 4:0:0 VAR3
    TSTGT CT 19:0:0  
    SET VAR3 0  
    TSTEQ VAR3 OP3  
    GOTO LOOP   
    SET OP3 VAR3  
    TSTEQ VAR3 1  
    EMAIL 7   
    TSTEQ VAR3 0  
    EMAIL 8   

    TSTLT AIP1 8  
    SET OP1 1  
    TSTGT AIP1 12  
    SET OP1 0  
    TSTLT T3 1080  
    SET OP2 1  
    TSTGT T3 1160  
    SET OP2 0  
    XOR OP1 VAR1  
    BZ  TEMPTEST  
    TSTEQ OP1 1  
    EMAIL 1   
    TSTEQ OP1 0  
    EMAIL 2   
TEMPTEST:
    XOR OP2 VAR2  
    BZ  DONE  
    TSTEQ OP2 1  
    EMAIL 3   
    TSTEQ OP2 0  
    EMAIL 4   
DONE:
    SET VAR1 OP1  
    SET VAR2 OP2  
    END    
 
 
siafu said:
I figured it out after many hours of testing.
 
On my board I need to use CT Current Time, command. and the times have to be in this format 00:00:00, strange.
 
So this is my setup so far, The green is the new code, and the black is what I had before. I'm not sure it the old code will work, will have to see in the morning when the lights are to be turned off, and see if the water heater tank sends emails about temps.
 
START    
LOOP:
    TSTGE CT 4:0:0 VAR3
    TSTGT CT 19:0:0  
    SET VAR3 0  
    TSTEQ VAR3 OP3  
    GOTO LOOP   
    SET OP3 VAR3  
    TSTEQ VAR3 1  
    EMAIL 7   
    TSTEQ VAR3 0  
    EMAIL 8   

    TSTLT AIP1 8  
    SET OP1 1  
.....
 
It's nice that you've used my code, but without understanding it it isn't going to do what you want.
As you have mashed the two streams together, your old code will only be executed twice a day. Once when the lights turn on and once when they turn off.
I don't think that's what you wanted.
 
START   
    TSTLT CY 2014
    GOTO ELIGHT
    TSTGE CT 4:0:0 VAR3
    TSTLT CT 19:0:0 VAR3 
    NOP
    SET OP3 VAR3  
    TSTEQ VAR4 VAR3
    GOTO ELIGHT
    TSTEQ VAR3 1  
    EMAIL 7   
    TSTEQ VAR3 0  
    EMAIL 8   
    SET VAR4 VAR3
ELIGHT:
    TSTLT AIP1 8  
    SET OP1 1  
    TSTGT AIP1 12  
    SET OP1 0  
    TSTLT T3 1080  
    SET OP2 1  
    TSTGT T3 1160  
    SET OP2 0  
    XOR OP1 VAR1  
    BZ  TEMPTEST  
    TSTEQ OP1 1  
    EMAIL 1   
    TSTEQ OP1 0  
    EMAIL 2   
TEMPTEST:
    XOR OP2 VAR2  
    BZ  DONE  
    TSTEQ OP2 1  
    EMAIL 3   
    TSTEQ OP2 0  
    EMAIL 4   
DONE:
    SET VAR1 OP1  
    SET VAR2 OP2  
    END  
 
Thank you AZ, worked,
 
I only had to make a small change
 
TSTLT CYEAR 2014
 
CY does not work with older firmware.
 
Back
Top