sparkysliderz
Member
Hi Guys,
yeah, its me again! I'm slooooowly getting to grips with this SCL stuff but I am stuck again!
I am trying to read in a time variable from a DB and load it into a timer
BUT!..... I'm not sure what format the time value is in. Is there a "cast" function I should be using?
Each time i try to compile I have the following (unhelpful) error message, "Invalid Data Type"
I have tried to change the type of value from "S5TIME" to "Time" in the DB but I just cant get it to compile!
Any help would be appreciated!
Thanks in advance guys.
yeah, its me again! I'm slooooowly getting to grips with this SCL stuff but I am stuck again!
I am trying to read in a time variable from a DB and load it into a timer
Code:
FUNCTION FC1: VOID
VAR_INPUT
State:BOOL;
ByteNum:INT;
BitNum:INT;
MyTime :TIMER;
END_VAR
VAR
TimerNum:INT;
set:BOOL;
reset:BOOL;
bcdvalue:S5TIME;
binvalue:WORD;
initalvalue:S5TIME;
END_VAR
BEGIN
IF State = 1 THEN
q[ByteNum,BitNum]:=1;
END_IF;
IF State = 0 THEN
q[ByteNum,BitNum]:=0;
END_IF;
TimerNum:=WORD_TO_INT(db1.dbw8);
set:=i[0,0];
reset:=i[0,1];
[color=seagreen] initalvalue:=T#10s; // this will compile[/color]
[color=red] initalvalue:= db1.dbw6; // this wont!
[/color] bcdvalue:= S_ODT( T_NO := TimerNum,
s:= set,
tv:= initalvalue,
r:= reset,
bi:= binvalue,
q:=q0.7);
qw4:=binvalue;
END_FUNCTION
Each time i try to compile I have the following (unhelpful) error message, "Invalid Data Type"
I have tried to change the type of value from "S5TIME" to "Time" in the DB but I just cant get it to compile!
Any help would be appreciated!
Thanks in advance guys.