Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched.
Close
I have a Function Block defined as follows. This refers to a BOOL in PRG SCREEN ( Ladder ) called βBlockedβ β SCREEN.Blocked β and I inserted that using the input assistant. When I build the code I get an error: βBlocked βis no input of βSCREENβ. Its not a very descriptive error β and cant find any info about it β What could be wrong? Thanks for your help
iattempnumber := 0;
SCREEN.Blocked:= 0;
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN iattempnumber := 10;
CASE iattempnumber OF
10:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#2S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 20;
20:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#4S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 30;
30:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#8S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 40;
40:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#16S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 50;
50:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#32S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 60;
60:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN
SCREEN.Blocked_Alarm := 1;
SCREEN.Blocked := 1;
SCREEN.Blocked_Shutdown := 1;
END_IF ;
iattempnumber := 0;
END_CASE
END_IF
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the error is very descriptive!
It tells you that the compiler can't "see" the variable Blocked in your prg SCREEN.
Most probably you have declared it as a VAR instead of a VAR_INPUT in the header of SCREEN.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
If I understand correctly the code you list is part of a FB and it is attempting to access a bool defined in a program. If this is the case, it's generally considered bad practice to access external variables in this manner. It's preferred to define FB input and out parameters instead.
You are probably getting the error because Blocked is defined in a VAR section, which is not externally accessible, instead of a VAR_INPUT section which is externally accessible.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all
I have a Function Block defined as follows. This refers to a BOOL in PRG SCREEN ( Ladder ) called βBlockedβ β SCREEN.Blocked β and I inserted that using the input assistant. When I build the code I get an error: βBlocked βis no input of βSCREENβ. Its not a very descriptive error β and cant find any info about it β What could be wrong? Thanks for your help
iattempnumber := 0;
SCREEN.Blocked:= 0;
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN iattempnumber := 10;
CASE iattempnumber OF
10:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#2S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 20;
20:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#4S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 30;
30:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#8S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 40;
40:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#16S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 50;
50:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN SCREEN.Blocked := 1;
MotorSetpointHz := MOVE(-500);
Blocked_Reverse_Running := 1;
TONRunReverseTime.IN := Blocked_Reverse_Running;
TONRunReverseTime.PT := T#32S;
TONRunReverseTime.Q := Blocked_Reverse_Stopped;
SCREEN.Blocked := 0;
END_IF ;
iattempnumber := 60;
60:
IF Current >= SCREEN.HMI_Current_Blockage_Setpoint THEN
SCREEN.Blocked_Alarm := 1;
SCREEN.Blocked := 1;
SCREEN.Blocked_Shutdown := 1;
END_IF ;
iattempnumber := 0;
END_CASE
END_IF
I think the error is very descriptive!
It tells you that the compiler can't "see" the variable Blocked in your prg SCREEN.
Most probably you have declared it as a VAR instead of a VAR_INPUT in the header of SCREEN.
If I understand correctly the code you list is part of a FB and it is attempting to access a bool defined in a program. If this is the case, it's generally considered bad practice to access external variables in this manner. It's preferred to define FB input and out parameters instead.
You are probably getting the error because Blocked is defined in a VAR section, which is not externally accessible, instead of a VAR_INPUT section which is externally accessible.
Thanks for your help Kim .... am still fairly new to Codesys You were correct......
Thanks for the comment Rick, I'll try it the way you suggest as well....