RMA
Member
I spent the best part of a day on site last week trying to get this working, to no avail (fortunately they were so far behind with the H/W that I had plenty of time to myself!).
I'm not sure whether it's my old problem with Timers, but I have a sneaky feeling it might be something else this time, Local Data problems, perhaps?
Either way, I've got to the point where I can't see the wood for the trees now, so I'd be grateful if some of the usual suspects could take a look at this for me.
The file is a normal Step7 AWL source file renamed to FB3.txt so as to be able to upload it.
Edit: Hey, that's neat - automatic scrolling windows with the [ code ] command!
I'm not sure whether it's my old problem with Timers, but I have a sneaky feeling it might be something else this time, Local Data problems, perhaps?
Either way, I've got to the point where I can't see the wood for the trees now, so I'd be grateful if some of the usual suspects could take a look at this for me.
The file is a normal Step7 AWL source file renamed to FB3.txt so as to be able to upload it.
Code:
FUNCTION_BLOCK "INIT Module LTS"
TITLE =Initialisiere Lasttrennschalter (LST) beim RESET.
//This FB is called from FB99 with a Module Number as Input Parameter. The Block
//then Closes the motor driven switch to short circuit the Crowbar resistors and
//opens the switches connecting the POS and NEG Outputs of the capacitors to the
//Kollektors.
VERSION : 0.1
VAR_INPUT
Module_Nr : INT ;
END_VAR
VAR
Trigger : BOOL ; //Trigger for Timers
First_Time : BOOL ;
Hilfsmerker : BOOL ; //Hilfsmerker für Flanke
END_VAR
VAR_TEMP
Module_Base : INT ;
Output_Crowbar : DWORD ;
Output_LTS_NEG : DWORD ;
Output_LTS_POS : DWORD ;
END_VAR
BEGIN
NETWORK
TITLE =Init
U #First_Time;
SPB strt;
SET ;
R #Trigger; //Initialise Delay timer
S #First_Time; //and set First_Time Flag
NETWORK
TITLE =Get Module Number and calaculate position of first Output
//There is nothing clever here, the pattern of the PAW Outputs repeats itself for
//each module and each Module has 4 Bytes of Outputs. The only oddity comes from
//the consolidation of the original two 1,44 MJ Modules, 11 and 12, to
//one 2,88 MJ Module. As a result of this, there is a gap of four unused
//Addresses in the Module Outputs at this point.
strt: NOP 0;
L #Module_Nr;
L 11; //Check for Modules 12 and higher
>I ;
SPB Top;
DEC 1; //Decrement because Module 1 starts at A0.0
L 4; //Each Module has 4 Bytes of Outputs
*I ;
T #Module_Base; //Save as Pointer Base
SPA cont; //and start opening LTSs
Top: NOP 0;
TAK ; //Get Module Nr. back in AKKU1
L 4; //No need to subtract 1 here because of
*I ; //missing Module following upgrade of
T #Module_Base; //Module 11 to 2.88 MJ (Prev. 11 & 12 combined)
NETWORK
TITLE =Form Pointer and Output "CLOSE" Crowbar LTS Pulse.
cont: NOP 0;
L P#0.0;
L #Module_Base;
SLD 3; //Convert Base Address to Byte.Bit format
+D ;
L 1; //Add Bit Offset for Crowbar LTS-ZU
+D ;
T #Output_Crowbar;
U #Trigger;
L S5T#1S;
SV "T_LTS_CROWBAR";
U "T_LTS_CROWBAR";
= A [#Output_Crowbar];
NETWORK
TITLE =Form Pointer and Output "OPEN" NEG LTS Pulse.
L P#0.0;
L #Module_Base;
SLD 3; //Convert Base Address to Byte.Bit format
+D ;
L 9; //Add Bit Offset for LTS_NEG_AUF
+D ;
T #Output_LTS_NEG;
U #Trigger;
L S5T#1S;
SV "T_LTS_NEG";
U "T_LTS_NEG";
= A [#Output_LTS_NEG];
NETWORK
TITLE =Form Pointer and Output "OPEN" POS LTS Pulse.
L P#0.0;
L #Module_Base;
SLD 3; //Convert Base Address to Byte.Bit format
+D ;
L 7; //Add Bit Offset for LTS_POS-AUF
+D ;
T #Output_LTS_POS;
U #Trigger;
L S5T#1S;
SV "T_LTS_POS";
U "T_LTS_POS";
= A [#Output_LTS_POS];
NETWORK
TITLE =Set Trigger Bit to start Timers
//Trigger is also used by calling Block, FB99, as BUSY Flag by accessing it
//directly in the IDB for FB3.
NOP 0;
U #Trigger;
L S5T#10S;
SV "T_LTS_INIT_PERIOD";
SET ;
S #Trigger;
NETWORK
TITLE =
U "T_LTS_INIT_PERIOD";
FN #Hilfsmerker;
R #Trigger; //Clear BUSY
R #First_Time;
END_FUNCTION_BLOCK
Edit: Hey, that's neat - automatic scrolling windows with the [ code ] command!
Last edited: