Hi
I am starting to look into S7 pointers
I have 3 data blocks in which i wish to compare bits.
Below (ladder logic made to source file) is a basic list of a single alarm construct that i wish to
whizz through 128 times, incrementing the datablocks bit address each time. I havent dont it below but i intend to use an input variable for the length (128)
Essentially, How do i index the datablock bit and is a for next loop style construct ok like this
Next:
{my code}
Loop
FUNCTION FC 123 : VOID
TITLE =
VERSION : 0.1
VAR_OUTPUT
Warning : BOOL ;
Critical : BOOL ;
Buzzer : BOOL ;
END_VAR
VAR_TEMP
On : BOOL ;
END_VAR
BEGIN
NETWORK
TITLE =Clear the blocks internal bits ready for processing
R #Critical;
R #Warning;
R #Buzzer;
NETWORK
TITLE =Alarm001 is Active
A DB10.DBX0.0; //alarm bit is active
= L 1.0;
A L 1.0;
A DB14.DBX0.0; //critical alarm bit
S #Critical;
A L 1.0;
AN DB14.DBX0.0; //not critical so warning only
S #Warning;
A L 1.0;
AN DB12.DBX0.0; //alarm acked
S #Buzzer;
/// Alarm001 has cleared, is acknowledged, clear acknowledge
AN DB10.DBX0.0;
A DB12.DBX0.0;
R DB12.DBX0.0;
END_FUNCTION
I am starting to look into S7 pointers
I have 3 data blocks in which i wish to compare bits.
Below (ladder logic made to source file) is a basic list of a single alarm construct that i wish to
whizz through 128 times, incrementing the datablocks bit address each time. I havent dont it below but i intend to use an input variable for the length (128)
Essentially, How do i index the datablock bit and is a for next loop style construct ok like this
Next:
{my code}
Loop
FUNCTION FC 123 : VOID
TITLE =
VERSION : 0.1
VAR_OUTPUT
Warning : BOOL ;
Critical : BOOL ;
Buzzer : BOOL ;
END_VAR
VAR_TEMP
On : BOOL ;
END_VAR
BEGIN
NETWORK
TITLE =Clear the blocks internal bits ready for processing
R #Critical;
R #Warning;
R #Buzzer;
NETWORK
TITLE =Alarm001 is Active
A DB10.DBX0.0; //alarm bit is active
= L 1.0;
A L 1.0;
A DB14.DBX0.0; //critical alarm bit
S #Critical;
A L 1.0;
AN DB14.DBX0.0; //not critical so warning only
S #Warning;
A L 1.0;
AN DB12.DBX0.0; //alarm acked
S #Buzzer;
/// Alarm001 has cleared, is acknowledged, clear acknowledge
AN DB10.DBX0.0;
A DB12.DBX0.0;
R DB12.DBX0.0;
END_FUNCTION