I am trying to accomplish very simple task, but it looks like I cannot figure our how.
My task is daily schedule. output Q1
have to be HIGH
every day from 1:00 to 2:00. I could not find function block that would help me. I decided to create my own.
Here are my definitions.
FUNCTION_BLOCK Shedule
VAR_INPUT
EN: BOOL;
MO: INT;
TU: INT;
WE: INT;
TH: INT;
FR: INT;
SA: INT;
SU: INT;
T1: STRING;
END_VAR
VAR_OUTPUT
Q: BOOL;
END_VAR
The idea is this. EN
is input. It should be HIGH
for output Q
to become HIGH
too.
Others are days of the week. I can set 1 or 0 if I want Schedule work on that day. Pretty much universal function block to create any type of schedules.
Question 1: When I make week day variables type BOOL
, when I add block to the LD line, it creates contact for every week day parameter.
What can I do to make only EN
contact connected to the line?
If I try to add function block with EN/ENO, then I do not know
1) How do I know inside function block that EN
is HIGh
or how do I get access to that variable?
2) I cannot connect coil to my Q
output. it only connects to ENO
. how do i control state of ENO
?
But that is not all. I added Time and Date library
But only thing I found to work with time is RTCLK.GetDateAndTime
function block. And i cannot figure out how to work with it.
My simple task is to get current TIME only and current day of the week and if this week is enabled and current time in the range in input T1
- make Q
= HIGH
otherwise LOW
.
Any hints on that?
Write a function block as follows which will be called cyclically (e.g. every 60sec):
You should use library functions for the handling of the day and time values. Maybe you should check out the free library OSCAT BASIC. The website is in German but the documentation and the software is in English.