Przejdź do głównej zawartości

Simple Timer-Based Relay Control

Ta treść nie jest jeszcze dostępna w Twoim języku.

This program example switches the EM-486’s relay on/off depending on time of day. At the specified times of the day it switches the relay OFF and ON. Required condition is that OFF-time should be before (less than) ON-time.

The program is controlled through Overvis using registers on EM-486 device.

AddressDescription
5250OFF time of day in seconds (e.g. 12:34 is 12×3600+34×60=45240).
5251ON time of day in seconds.
Terminal window
!META
* PROTOCOLVERSION 9
!PARAMS
# Current time of day in seconds (EM-486 register)
0 * INT32 H 230
# Setting: Time to turn relay OFF, in seconds
1 * INT32 H 5500
# Setting: Time to turn relay ON, in seconds
2 * INT32 H 5502
# EM-486 relay 1 state
3 * UINT16 H 160
!VARS
# Current time of day in seconds
0 PARAMVAL P0
# Time to turn relay OFF, in seconds
1 PARAMVAL P1
# Time to turn relay ON, in seconds
2 PARAMVAL P2
# EM-486 relay 1 state
3 PARAMVAL P3
!CONDS
# Time of day has already reached switching off time today
0 VARGEVAR V0 V1
# Time of day hasn't yet reached switching on time today
1 VARLSVAR V0 V2
# Relay 2 is switched on
2 VAREQVAL V3 1
# Relay 2 is switched off
3 VAREQVAL V3 0
# It's time to switch the relay OFF
4 AND C0 C1
# It's time to switch the relay ON
5 NOT C4
# Relay should be switched ON
6 AND C3 C5
# Relay should be switched OFF
7 AND C2 C4
!ACTS
0 RELAYON 1 1
1 RELAYOFF 1 1
!REACTS
* C6 ACT A0
* C7 ACT A1
# END.

This program can be modified to control the OB-215 relay with EM-486. In that case, parameter P3 should be changed to the relay register of OB-215 and ON/OFF actions (section !ACTS) should be changed to the OB-215 control register command. See Astronomical Timer example for reference.