Confused "again" S7 indirect

Thim

Member
Join Date
Mar 2008
Location
Belgium
Posts
392
Hi

can some tell me why my timer doesn't work correct what i can see is that it doesn't open the DB correctly. I previous network where i load the value to temp everythings seems ok and the network is still active.

Can someone tell me what i'm doing wrong?

Thx alot
 
You should not jump around the timer, just use the logic you require to start the timer prior to the SD instruction.
 
That i did in the beginning but like you can see it is indirect and the value in the db is not allways loaded like in the beginning it is a free value and the it gives me a system error that the db is not loaded also the value in DBW is not allways the correct value then i get an alarm out of range
 
it is like you can say

A I 0.0
L 0.0
L 5.0
+R
t MD0

or

A I0.0
jcn _001
L 0.0
L 5.0
+R
T MD 0
_001 : nop 0

I think there is a difference between the first and second
First it will allways make the calculation
Second only when I0.0 is 1 it will make the calculation

Or do you mean to make this out of it

A #Doseren.Naval_wh1
JCN _012
A #Doseren.Naval_wh1
OPN DB [#Enkel_word.Word1_2]
L DBW [#Dubbel_word.Dword1_19]
SD #Naval_timer_wh1
_012: NOP 0
 
Last edited:
Without sight of all of the code it will be difficult to spot your coding error !

Code:
A #Doseren.Naval_wh1
OPN DB [#Enkel_word.Word1_2]
L DBW [#Dubbel_word.Dword1_19]
SD #Naval_timer_wh1

will do the job of fixing the timer. Now for the DB problem you must post all the relevant code.
 
Last edited:
It will be in bits and pieces

Code:
FUNCTION_BLOCK "Doseren"
TITLE =
//Opgelet NETWERK3&4 gaat over reservatie van WH deze NETWERKEN zijn installatie 
//afhankelijk. Het is bv mogelijk dat men verplicht wordt door mechanisch 
//opstelling meerdere wh te reserveren ook al heeft men deze niet nodig voor te 
//doseren. 
VERSION : 0.1
 
VAR_INPUT
Start_comp_wh1 : BOOL ; //Indien hoog mag men overgaan naar volgend component
Transport_ok_wh1 : BOOL ; //Indien hoog mag men starten met doseren
Start_comp_wh2 : BOOL ; //Indien hoog mag men overgaan naar volgend component
Transport_ok_wh2 : BOOL ; //Indien hoog mag men starten met doseren
Start_comp_wh3 : BOOL ; //Indien hoog mag men overgaan naar volgend component
Transport_ok_wh3 : BOOL ; //Indien hoog mag men starten met doseren
Start_comp_wh4 : BOOL ; //Indien hoog mag men overgaan naar volgend component
Transport_ok_wh4 : BOOL ; //Indien hoog mag men starten met doseren
Start_comp_wh5 : BOOL ; //Indien hoog mag men overgaan naar volgend component
Transport_ok_wh5 : BOOL ; //Indien hoog mag men starten met doseren
Alarm_recept : BOOL ; //Indien hoog mag men niet starten met recept
Naval_timer_wh1 : TIMER ; 
Naval_timer_wh2 : TIMER ; 
Naval_timer_wh3 : TIMER ; 
Naval_timer_wh4 : TIMER ; 
Naval_timer_wh5 : TIMER ; 
END_VAR
VAR_OUTPUT
Wh_nr_route_wh1 : INT ; //Naar waar er wordt gedosseerd 
Silo_nr_route_wh1 : INT ; //Van waar er wordt gedosseerd
Frequentie_analoog_wh1 : REAL ; 
Hoge_snelheid_wh1 : BOOL ;	
Lage_snelheid_wh1 : BOOL ; 
Einde_doseren_comp_wh1 : BOOL ; 
Einde_doseren_Wh1 : BOOL ;	
Buiten_tolerantie_wh1 : BOOL ;	
DTO_alarm_wh1 : BOOL ;	
Wh_nr_route_wh2 : INT ; //Naar waar er wordt gedosseerd 
Silo_nr_route_wh2 : INT ; //Van waar er wordt gedosseerd
Frequentie_analoog_wh2 : REAL ; 
Hoge_snelheid_wh2 : BOOL ;	
Lage_snelheid_wh2 : BOOL ;	
Einde_doseren_comp_wh2 : BOOL ; 
Einde_doseren_Wh2 : BOOL ;	
Buiten_tolerantie_wh2 : BOOL ;	
DTO_alarm_wh2 : BOOL ;	
Wh_nr_route_wh3 : INT ; //Naar waar er wordt gedosseerd 
Silo_nr_route_wh3 : INT ; //Van waar er wordt gedosseerd
Frequentie_analoog_wh3 : REAL ; 
Hoge_snelheid_wh3 : BOOL ;	
Lage_snelheid_wh3 : BOOL ;	
Einde_doseren_comp_wh3 : BOOL ; 
Einde_doseren_Wh3 : BOOL ;	
Buiten_tolerantie_wh3 : BOOL ;	
DTO_alarm_wh3 : BOOL ;	
Wh_nr_route_wh4 : INT ; //Naar waar er wordt gedosseerd 
Silo_nr_route_wh4 : INT ; //Van waar er wordt gedosseerd
Frequentie_analoog_wh4 : REAL ; 
Hoge_snelheid_wh4 : BOOL ;	
Lage_snelheid_wh4 : BOOL ; 
Einde_doseren_comp_wh4 : BOOL ; 
Einde_doseren_Wh4 : BOOL ;	
Buiten_tolerantie_wh4 : BOOL ;	
DTO_alarm_wh4 : BOOL ;	
Wh_nr_route_wh5 : INT ; //Naar waar er wordt gedosseerd 
Silo_nr_route_wh5 : INT ; //Van waar er wordt gedosseerd
Frequentie_analoog_wh5 : REAL ; 
Hoge_snelheid_wh5 : BOOL ;	
Lage_snelheid_wh5 : BOOL ;	
Einde_doseren_comp_wh5 : BOOL ; 
Einde_doseren_Wh5 : BOOL ;	
Buiten_tolerantie_wh5 : BOOL ;	
DTO_alarm_wh5 : BOOL ;	
END_VAR
VAR
Wh1 : "ijkenWH"; 
Wh2 : "ijkenWH"; 
Wh3 : "ijkenWH"; 
Wh4 : "ijkenWH"; 
Wh5 : "ijkenWH"; 
Doseren : STRUCT 
Start_recept : BOOL ;	
Stop_recept : BOOL ; 
Skip_component_Wh1 : BOOL ; 
Skip_component_Wh2 : BOOL ; 
Skip_component_Wh3 : BOOL ; 
Skip_component_Wh4 : BOOL ; 
Skip_component_Wh5 : BOOL ; 
Route_geladen_Wh1 : BOOL ; 
Route_geladen_Wh2 : BOOL ; 
Route_geladen_Wh3 : BOOL ; 
Route_geladen_Wh4 : BOOL ; 
Route_geladen_Wh5 : BOOL ; 
Check_reservatie : BOOL ; 
Doseren : BOOL ; 
FP_reservatie : BOOL ; 
WH1_comp_geladen : BOOL ;	//Indien hoog is op WH1 iets aan het doseren
WH2_comp_geladen : BOOL ;	//Indien hoog is op WH2 iets aan het doseren
WH3_comp_geladen : BOOL ;	//Indien hoog is op WH3 iets aan het doseren
WH4_comp_geladen : BOOL ;	//Indien hoog is op WH4 iets aan het doseren
WH5_comp_geladen : BOOL ;	//Indien hoog is op WH5 iets aan het doseren
FP_transport_ok_wh1 : BOOL ; 
FP_transport_ok_wh2 : BOOL ;	
FP_transport_ok_wh3 : BOOL ; 
FP_transport_ok_wh4 : BOOL ; 
FP_transport_ok_wh5 : BOOL ; 
Transport_wh1_set : BOOL ; 
Transport_wh2_set : BOOL ; 
Transport_wh3_set : BOOL ; 
Transport_wh4_set : BOOL ; 
Transport_wh5_set : BOOL ; 
Naval_wh1 : BOOL ; 
Naval_wh2 : BOOL ; 
Naval_wh3 : BOOL ; 
naval_wh4 : BOOL ; 
Naval_wh5 : BOOL ; 
Wh1_real_tarra_waarde : REAL ; //Is getarreerd gewicht enkel software matig 
Wh2_real_tarra_waarde : REAL ; //Is getarreerd gewicht enkel software matig 
Wh3_real_tarra_waarde : REAL ; //Is getarreerd gewicht enkel software matig 
Wh4_real_tarra_waarde : REAL ; //Is getarreerd gewicht enkel software matig 
Wh5_real_tarra_waarde : REAL ; //Is getarreerd gewicht enkel software matig 
Wh1_real_waarde : REAL ; //Is Wh_ingangswaarde min Wh_real_tarra_waarde
Wh2_real_waarde : REAL ; //Is Wh_ingangswaarde min Wh_real_tarra_waarde
Wh3_real_waarde : REAL ; //Is Wh_ingangswaarde min Wh_real_tarra_waarde
Wh4_real_waarde : REAL ; //Is Wh_ingangswaarde min Wh_real_tarra_waarde
Wh5_real_waarde : REAL ; //Is Wh_ingangswaarde min Wh_real_tarra_waarde
Gevraagd_min_naval_Wh1 : REAL ; 
Gevraagd_min_naval_Wh2 : REAL ; 
Gevraagd_min_naval_Wh3 : REAL ; 
Gevraagd_min_naval_Wh4 : REAL ; 
Gevraagd_min_naval_Wh5 : REAL ; 
Reservatie_wh1 : INT ; 
Reservatie_wh2 : INT ; 
Reservatie_wh3 : INT ; 
Reservatie_wh4 : INT ; 
Reservatie_wh5 : INT ; 
te_doseren_comp_wh1 : INT ;	
te_doseren_comp_wh2 : INT ; 
te_doseren_comp_wh3 : INT ; 
te_doseren_comp_wh4 : INT ; 
te_doseren_comp_wh5 : INT ; 
END_STRUCT ; 
END_VAR
VAR_TEMP
Integer : STRUCT 
Int1 : INT ; 
Int1_1 : INT ; 
Int1_2 : INT ; 
Int1_3 : INT ; 
Int1_4 : INT ; 
Int1_5 : INT ; 
Int1_6 : INT ; 
Int1_7 : INT ; 
Int1_8 : INT ; 
Int1_9 : INT ; 
Int1_10 : INT ; 
Int1_11 : INT ; 
Int1_12 : INT ; 
Int1_13 : INT ; 
Int1_14 : INT ; 
Int1_15 : INT ; 
Int1_16 : INT ; 
Int1_17 : INT ; 
Int1_18 : INT ; 
Int1_19 : INT ; 
Int1_20 : INT ; 
END_STRUCT ; 
Dubbel_word : STRUCT 
Dword1 : DWORD ; 
Dword1_1 : DWORD ; 
Dword1_2 : DWORD ; 
Dword1_3 : DWORD ; 
Dword1_4 : DWORD ; 
Dword1_5 : DWORD ; 
Dword1_6 : DWORD ; 
Dword1_7 : DWORD ; 
Dword1_8 : DWORD ; 
Dword1_9 : DWORD ; 
Dword1_10 : DWORD ; 
Dword1_11 : DWORD ; 
Dword1_12 : DWORD ; 
Dword1_13 : DWORD ; 
Dword1_14 : DWORD ; 
Dword1_15 : DWORD ; 
Dword1_16 : DWORD ; 
Dword1_17 : DWORD ; 
Dword1_18 : DWORD ; 
Dword1_19 : DWORD ; 
Dword1_20 : DWORD ; 
Dword1_21 : DWORD ; 
Dword1_22 : DWORD ; 
Dword1_23 : DWORD ; 
Dword1_24 : DWORD ; 
Dword1_25 : DWORD ; 
Dword1_26 : DWORD ; 
Dword1_27 : DWORD ; 
Dword1_28 : DWORD ; 
Dword1_29 : DWORD ; 
Dword1_30 : DWORD ; 
Dword1_31 : DWORD ; 
Dword1_32 : DWORD ; 
Dword1_33 : DWORD ; 
Dword1_34 : DWORD ; 
Dword1_35 : DWORD ; 
Dword1_36 : DWORD ; 
Dword1_37 : DWORD ; 
Dword1_38 : DWORD ; 
Dword1_39 : DWORD ; 
Dword1_40 : DWORD ; 
Dword1_41 : DWORD ; 
Dword1_42 : DWORD ; 
Dword1_43 : DWORD ; 
Dword1_44 : DWORD ; 
Dword1_45 : DWORD ; 
Dword1_46 : DWORD ; 
Dword1_47 : DWORD ; 
Dword1_48 : DWORD ; 
Dword1_49 : DWORD ; 
Dword1_50 : DWORD ; 
Dword1_51 : DWORD ; 
Dword1_52 : DWORD ; 
Dword1_53 : DWORD ; 
Dword1_54 : DWORD ; 
Dword1_55 : DWORD ; 
Dword1_56 : DWORD ; 
Dword1_57 : DWORD ; 
Dword1_58 : DWORD ; 
Dword1_59 : DWORD ; 
Dword1_60 : DWORD ; 
Dword1_61 : DWORD ; 
Dword1_62 : DWORD ; 
Dword1_63 : DWORD ; 
Dword1_64 : DWORD ; 
Dword1_65 : DWORD ; 
Dword1_66 : DWORD ; 
Dword1_67 : DWORD ; 
Dword1_68 : DWORD ; 
Dword1_69 : DWORD ; 
Dword1_70 : DWORD ; 
Dword1_71 : DWORD ; 
Dword1_72 : DWORD ; 
Dword1_73 : DWORD ; 
Dword1_74 : DWORD ; 
Dword1_75 : DWORD ; 
Dword1_76 : DWORD ;	
Dword1_77 : DWORD ; 
Dword1_78 : DWORD ; 
Dword1_79 : DWORD ; 
Dword1_80 : DWORD ; 
END_STRUCT ; 
Enkel_word : STRUCT 
Word1 : WORD ; 
Word1_1 : WORD ; 
Word1_2 : WORD ; 
Word1_3 : WORD ; 
Word1_4 : WORD ; 
Word1_5 : WORD ; 
Word1_6 : WORD ; 
Word1_7 : WORD ; 
Word1_8 : WORD ; 
Word1_9 : WORD ; 
Word1_10 : WORD ;	
Word1_11 : WORD ;	
Word1_12 : WORD ;	
Word1_13 : WORD ;	
Word1_14 : WORD ;	
Word1_15 : WORD ; 
Word1_16 : WORD ;	
Word1_17 : WORD ;	
Word1_18 : WORD ;	
Word1_19 : WORD ;	
Word1_20 : WORD ;	
END_STRUCT ; 
FP_Uitgang_reservatie : BOOL ;	
FP_uitgang_trans_ok_wh1 : BOOL ; 
FP_uitgang_trans_ok_wh2 : BOOL ; 
FP_uitgang_trans_ok_wh3 : BOOL ; 
FP_uitgang_trans_ok_wh4 : BOOL ; 
FP_uitgang_trans_ok_wh5 : BOOL ; 
END_VAR
BEGIN
NETWORK
TITLE =
	 CALL #Wh1 (
		 FB152_WH_leeg_timer	 := T	 1,
		 FB152_Einde_transport	:= M	 25.0);
	 CALL #Wh2 (
		 FB152_WH_leeg_timer	 := T	 2,
		 FB152_Einde_transport	:= M	 25.1);
	 CALL #Wh3 (
		 FB152_WH_leeg_timer	 := T	 3,
		 FB152_Einde_transport	:= M	 25.2);
	 CALL #Wh4 (
		 FB152_WH_leeg_timer	 := T	 4,
		 FB152_Einde_transport	:= M	 25.3);
	 CALL #Wh5 (
		 FB152_WH_leeg_timer	 := T	 5,
		 FB152_Einde_transport	:= M	 25.4);
 
Code:
_002: NOP   0; 
NETWORK
TITLE =
	  A	 #Doseren.Check_reservatie; 
	  JCN   _021; 
	  L	 "Data DB UDT110".DATA_DB.DB_NR_DB_LIJN1; 
	  T	 #Enkel_word.Word1_1; 
	  L	 "Data DB UDT110".DATA_DB.SILO_GEGEVENES_DB; 
	  T	 #Enkel_word.Word1_2; 
	  L	 "Data DB UDT110".DATA_DB.SILO_COMPONENTEN_DB; 
	  T	 #Enkel_word.Word1_3; 
_021: NOP   0; 
// L	 1.000000e+002
// T	 "Data DB UDT110".DATA_DB.WH1_inhoud
// T	 "Data DB UDT110".DATA_DB.WH2_inhoud

NETWORK
TITLE =
//enkel de nodige Wh_reserveren. andere wh reservatie in STRUCT.doseren op 1 
//zetten "1" is nr van de lijn
	  A	 #FP_Uitgang_reservatie; 
	  JCN   _003; 
	  LAR1  P#1622.0; 
	  TAR1  #Dubbel_word.Dword1_5; 
	  LAR1  P#144.0; 
	  TAR1  #Dubbel_word.Dword1_6; 
	  LAR1  P#568.0; 
	  TAR1  #Dubbel_word.Dword1_7; 
	  L	 5; 
nex3: T	 #Integer.Int1_1; 
	  OPN   "Data DB UDT110"; 
	  L	 DBD [#Dubbel_word.Dword1_5]; 
	  L	 0.000000e+000; 
	  ==R   ; 
	  JC	_031; 
	  L	 1; 
	  T	 DIW [#Dubbel_word.Dword1_6]; 
	  JC	_032; 
_031: L	 1; 
	  T	 DIW [#Dubbel_word.Dword1_7]; 
_032: LAR1  #Dubbel_word.Dword1_5; 
	  +AR1  P#8.0; 
	  TAR1  #Dubbel_word.Dword1_5; 
	  LAR1  #Dubbel_word.Dword1_6; 
	  +AR1  P#88.0; 
	  TAR1  #Dubbel_word.Dword1_6; 
	  LAR1  #Dubbel_word.Dword1_7; 
	  +AR1  P#2.0; 
	  TAR1  #Dubbel_word.Dword1_7; 
	  L	 #Integer.Int1_1; 
	  LOOP  nex3; 
_003: NOP   0; 
NETWORK
TITLE =
//Controleren of alle gereserveerde wh vrijgave hebben dan pas starten met 
//doseren 
	  A	 #Doseren.Check_reservatie; 
	  JCN   _004; 
	  L	 #Doseren.Reservatie_wh1; 
	  L	 1; 
	  ==I   ; 
	  JC	_041; 
	  L	 #Wh1.FB152_WH_vrijgave; 
	  L	 1; 
	  ==I   ; 
	  JCN   _004; 
_041: L	 #Doseren.Reservatie_wh2; 
	  L	 1; 
	  ==I   ; 
	  JC	_042; 
	  L	 #Wh2.FB152_WH_vrijgave; 
	  L	 1; 
	  ==I   ; 
	  JCN   _004; 
_042: L	 #Doseren.Reservatie_wh3; 
	  L	 1; 
	  ==I   ; 
	  JC	_043; 
	  L	 #Wh3.FB152_WH_vrijgave; 
	  L	 1; 
	  ==I   ; 
	  JCN   _004; 
_043: L	 #Doseren.Reservatie_wh4; 
	  L	 1; 
	  ==I   ; 
	  JC	_044; 
	  L	 #Wh4.FB152_WH_vrijgave; 
	  L	 1; 
	  ==I   ; 
	  JCN   _004; 
_044: L	 #Doseren.Reservatie_wh5; 
	  L	 1; 
	  ==I   ; 
	  JC	_045; 
	  L	 #Wh5.FB152_WH_vrijgave; 
	  L	 1; 
	  ==I   ; 
	  JCN   _004; 
_045: S	 #Doseren.Doseren; 
_004: NOP   0; 
NETWORK
TITLE =
//Effectief starten met doseren op wh1
	  A	 #Doseren.Doseren; 
	  AN	#Doseren.WH1_comp_geladen; 
	  AN	#Einde_doseren_Wh1; 
	  JCN   _005; 
// kijken welke component eerst gevraagd word wanneer "0" niet verder kijken

	  OPN   DB [#Enkel_word.Word1_1]; 
	  L	 DBW [#Dubbel_word.Dword1_1]; 
	  L	 0; 
	  ==I   ; 
	  JC	_052; 
// wanneer niet nul component nr opvragen
	  OPN   DB [#Enkel_word.Word1_1]; 
	  L	 DBW [#Dubbel_word.Dword1_1]; 
	  T	 #Integer.Int1_2; 
	  L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	  *I	; 
	  L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	  -I	; 
	  T	 #Integer.Int1_3; 
// kijken in welke container deze component zit
	  L	 #Integer.Int1_3; 
	  L	 "Data DB UDT110".DATA_DB.Pos_container; 
	  +I	; 
	  T	 #Integer.Int1_4; 
	  SLD   3; 
	  T	 #Dubbel_word.Dword1_9; 
// eens container gekend kijken welke positie deze heeft
	  OPN   DB [#Enkel_word.Word1_3]; 
	  L	 DBW [#Dubbel_word.Dword1_9]; 
	  L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	  *I	; 
	  L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	  -I	; 
	  T	 #Integer.Int1_5; 
	  T	 #Integer.Int1_10; 
//positie van de container kennen we dan kijken welke wh deze heeft
	  L	 #Integer.Int1_5; 
	  L	 "Data DB UDT110".DATA_DB.Pos_wh_lijn1; 
	  +I	; 
	  T	 #Integer.Int1_6; 
	  SLD   3; 
	  T	 #Dubbel_word.Dword1_10; 
// kijken of Wh gelijk is aan 1 indien niet verder springen
	  OPN   DB [#Enkel_word.Word1_2]; 
	  L	 DBW [#Dubbel_word.Dword1_10]; 
	  L	 1; 
	  ==I   ; 
	  JCN   _051; 
// indien gelijk aan 1 route laden
	  OPN   DB [#Enkel_word.Word1_3]; 
	  L	 DBW [#Dubbel_word.Dword1_9]; 
	  T	 #Silo_nr_route_wh1; 
	  OPN   DB [#Enkel_word.Word1_2]; 
	  L	 DBW [#Dubbel_word.Dword1_10]; 
	  T	 #Wh_nr_route_wh1; 
	  OPN   DB [#Enkel_word.Word1_1]; 
	  L	 DBW [#Dubbel_word.Dword1_1]; 
	  T	 #Doseren.te_doseren_comp_wh1; 
	  S	 #Doseren.WH1_comp_geladen; 
	  JC	_005; 
// niet gelijk aan 1 adreswijzer verhogen naar volgende component uit recept
_051: LAR1  #Dubbel_word.Dword1_1; 
	  +AR1  P#10.0; 
	  TAR1  #Dubbel_word.Dword1_1; 
	  JC	_005; 
_052: S	 #Einde_doseren_Wh1; 
_005: NOP   0; 
NETWORK
TITLE =
	  A	 #Doseren.Doseren; 
	  AN	#Doseren.WH2_comp_geladen; 
	  AN	#Einde_doseren_Wh2; 
	  JCN   _006; 
// kijken welke component eerst gevraagd word wanneer "0" niet verder kijken
	  OPN   DB [#Enkel_word.Word1_1]; 
	  L	 DBW [#Dubbel_word.Dword1_21]; 
	  L	 0; 
	  ==I   ; 
	  JC	_062; 
// wanneer niet nul component nr opvragen
	  OPN   DB [#Enkel_word.Word1_1]; 
	  L	 DBW [#Dubbel_word.Dword1_21]; 
	  T	 #Integer.Int1_2; 
	  L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	  *I	; 
	  L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	  -I	; 
	  T	 #Integer.Int1_3; 
// kijken in welke container deze component zit
	  L	 #Integer.Int1_3; 
	  L	 "Data DB UDT110".DATA_DB.Pos_container; 
	  +I	; 
	  T	 #Integer.Int1_4; 
	  SLD   3; 
	  T	 #Dubbel_word.Dword1_29; 
// eens container gekend kijken welke positie deze heeft
	  OPN   DB [#Enkel_word.Word1_3]; 
	  L	 DBW [#Dubbel_word.Dword1_29]; 
	  L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	  *I	; 
	  L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	  -I	; 
	  T	 #Integer.Int1_5; 
	  T	 #Integer.Int1_11; 
//positie van de container kennen we dan kijken welke wh deze heeft
	  L	 #Integer.Int1_5; 
	  L	 "Data DB UDT110".DATA_DB.Pos_wh_lijn1; 
	  +I	; 
	  T	 #Integer.Int1_6; 
	  SLD   3; 
	  T	 #Dubbel_word.Dword1_30; 
// kijken of Wh gelijk is aan 1 indien niet verder springen
	  OPN   DB [#Enkel_word.Word1_2]; 
	  L	 DBW [#Dubbel_word.Dword1_30]; 
	  L	 2; 
	  ==I   ; 
	  JCN   _061; 
// indien gelijk aan 1 route laden
	  OPN   DB [#Enkel_word.Word1_3]; 
	  L	 DBW [#Dubbel_word.Dword1_29]; 
	  T	 #Silo_nr_route_wh2; 
	  OPN   DB [#Enkel_word.Word1_2]; 
	  L	 DBW [#Dubbel_word.Dword1_30]; 
	  T	 #Wh_nr_route_wh2; 
	  OPN   DB [#Enkel_word.Word1_1]; 
	  L	 DBW [#Dubbel_word.Dword1_21]; 
	  T	 #Doseren.te_doseren_comp_wh2; 
	  S	 #Doseren.WH2_comp_geladen; 
	  JC	_006; 
// niet gelijk aan 1 adreswijzer verhogen naar volgende component uit recept
_061: LAR1  #Dubbel_word.Dword1_21; 
	  +AR1  P#10.0; 
	  TAR1  #Dubbel_word.Dword1_21; 
	  JC	_006; 
_062: S	 #Einde_doseren_Wh2; 
_006: NOP   0;
 
Code:
NETWORK
TITLE =
	 A	 #Doseren.Doseren; 
	 AN	#Doseren.WH3_comp_geladen; 
	 AN	#Einde_doseren_Wh3; 
	 JCN _007; 
 
// kijken welke component eerst gevraagd word
 
	 OPN DB [#Enkel_word.Word1_1]; 
	 L	 DBW [#Dubbel_word.Dword1_12]; 
	 L	 0; 
	 ==I ; 
	 JC	_072; 
 
	 OPN DB [#Enkel_word.Word1_1]; 
	 L	 DBW [#Dubbel_word.Dword1_12]; 
	 T	 #Integer.Int1_2; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	 *I	; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	 -I	; 
	 T	 #Integer.Int1_3; 
 
// kijken in welke container deze component zit
 
	 L	 #Integer.Int1_3; 
	 L	 "Data DB UDT110".DATA_DB.Pos_container; 
	 +I	; 
	 T	 #Integer.Int1_4; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_9; 
 
// eens container gekend kijken welke positie deze heeft
 
	 OPN DB [#Enkel_word.Word1_3]; 
	 L	 DBW [#Dubbel_word.Dword1_9]; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	 *I	; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	 -I	; 
	 T	 #Integer.Int1_5; 
	 T	 #Integer.Int1_12; 
 
//positie van de container kennen we dan kijken welke wh deze heeft
 
	 L	 #Integer.Int1_5; 
	 L	 "Data DB UDT110".DATA_DB.Pos_wh_lijn1; 
	 +I	; 
	 T	 #Integer.Int1_6; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_10; 
 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBW [#Dubbel_word.Dword1_10]; 
	 L	 3; 
	 ==I ; 
	 JCN _071; 
 
	 OPN DB [#Enkel_word.Word1_3]; 
	 L	 DBW [#Dubbel_word.Dword1_9]; 
	 T	 #Silo_nr_route_wh3; 
 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBW [#Dubbel_word.Dword1_10]; 
	 T	 #Wh_nr_route_wh3; 
 
	 OPN DB [#Enkel_word.Word1_12]; 
	 L	 DBW [#Dubbel_word.Dword1_12]; 
	 T	 #Doseren.te_doseren_comp_wh3; 
 
	 S	 #Doseren.WH3_comp_geladen; 
 
	 JC	_007; 
 
_071: LAR1 #Dubbel_word.Dword1_12; 
	 +AR1 P#10.0; 
	 TAR1 #Dubbel_word.Dword1_12; 
	 JC	_007; 
 
_072: S	 #Einde_doseren_Wh3; 
 
_007: NOP 0; 
NETWORK
TITLE =
 
	 A	 #Doseren.Doseren; 
	 AN	#Doseren.WH4_comp_geladen; 
	 AN	#Einde_doseren_Wh4; 
	 JCN _008; 
 
// kijken welke component eerst gevraagd word
 
	 OPN DB [#Enkel_word.Word1_1]; 
	 L	 DBW [#Dubbel_word.Dword1_13]; 
	 L	 0; 
	 ==I ; 
	 JC	_082; 
 
	 OPN DB [#Enkel_word.Word1_1]; 
	 L	 DBW [#Dubbel_word.Dword1_13]; 
	 T	 #Integer.Int1_2; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	 *I	; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	 -I	; 
	 T	 #Integer.Int1_3; 
 
// kijken in welke container deze component zit
 
	 L	 #Integer.Int1_3; 
	 L	 "Data DB UDT110".DATA_DB.Pos_container; 
	 +I	; 
	 T	 #Integer.Int1_4; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_9; 
 
// eens container gekend kijken welke positie deze heeft
 
	 OPN DB [#Enkel_word.Word1_3]; 
	 L	 DBW [#Dubbel_word.Dword1_9]; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	 *I	; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	 -I	; 
	 T	 #Integer.Int1_5; 
	 T	 #Integer.Int1_13; 
 
//positie van de container kennen we dan kijken welke wh deze heeft
 
	 L	 #Integer.Int1_5; 
	 L	 "Data DB UDT110".DATA_DB.Pos_wh_lijn1; 
	 +I	; 
	 T	 #Integer.Int1_6; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_10; 
 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBW [#Dubbel_word.Dword1_10]; 
	 L	 4; 
	 ==I ; 
	 JCN _081; 
 
	 OPN DB [#Enkel_word.Word1_3]; 
	 L	 DBW [#Dubbel_word.Dword1_9]; 
	 T	 #Silo_nr_route_wh4; 
 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBW [#Dubbel_word.Dword1_10]; 
	 T	 #Wh_nr_route_wh4; 
 
	 OPN DB [#Enkel_word.Word1_13]; 
	 L	 DBW [#Dubbel_word.Dword1_13]; 
	 T	 #Doseren.te_doseren_comp_wh4; 
 
	 S	 #Doseren.WH4_comp_geladen; 
 
	 JC	_008; 
 
_081: LAR1 #Dubbel_word.Dword1_13; 
	 +AR1 P#10.0; 
	 TAR1 #Dubbel_word.Dword1_13; 
	 JC	_008; 
 
_082: S	 #Einde_doseren_Wh4; 
 
_008: NOP 0; 
NETWORK
TITLE =
 
	 A	 #Doseren.Doseren; 
	 AN	#Doseren.WH5_comp_geladen; 
	 AN	#Einde_doseren_Wh5; 
	 JCN _009; 
 
// kijken welke component eerst gevraagd word
 
	 OPN DB [#Enkel_word.Word1_1]; 
	 L	 DBW [#Dubbel_word.Dword1_14]; 
	 L	 0; 
	 ==I ; 
	 JC	_092; 
 
	 OPN DB [#Enkel_word.Word1_1]; 
	 L	 DBW [#Dubbel_word.Dword1_14]; 
	 T	 #Integer.Int1_2; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	 *I	; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_compgeg; 
	 -I	; 
	 T	 #Integer.Int1_3; 
 
// kijken in welke container deze component zit
 
	 L	 #Integer.Int1_3; 
	 L	 "Data DB UDT110".DATA_DB.Pos_container; 
	 +I	; 
	 T	 #Integer.Int1_4; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_9; 
 
// eens container gekend kijken welke positie deze heeft
 
	 OPN DB [#Enkel_word.Word1_3]; 
	 L	 DBW [#Dubbel_word.Dword1_9]; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	 *I	; 
	 L	 "Data DB UDT110".DATA_DB.Pos_start_array2_cont; 
	 -I	; 
	 T	 #Integer.Int1_5; 
	 T	 #Integer.Int1_14; 
 
//positie van de container kennen we dan kijken welke wh deze heeft
 
	 L	 #Integer.Int1_5; 
	 L	 "Data DB UDT110".DATA_DB.Pos_wh_lijn1; 
	 +I	; 
	 T	 #Integer.Int1_6; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_10; 
 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBW [#Dubbel_word.Dword1_10]; 
	 L	 5; 
	 ==I ; 
	 JCN _091; 
 
	 OPN DB [#Enkel_word.Word1_3]; 
	 L	 DBW [#Dubbel_word.Dword1_9]; 
	 T	 #Silo_nr_route_wh5; 
 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBW [#Dubbel_word.Dword1_10]; 
	 T	 #Wh_nr_route_wh5; 
 
	 OPN DB [#Enkel_word.Word1_14]; 
	 L	 DBW [#Dubbel_word.Dword1_14]; 
	 T	 #Doseren.te_doseren_comp_wh5; 
 
	 S	 #Doseren.WH5_comp_geladen; 
 
	 JC	_009; 
 
_091: LAR1 #Dubbel_word.Dword1_14; 
	 +AR1 P#10.0; 
	 TAR1 #Dubbel_word.Dword1_14; 
	 JC	_009; 
 
_092: S	 #Einde_doseren_Wh5; 
 
_009: NOP 0; 
NETWORK
TITLE =
 
 
	 L	 MD 150; 
	 T	 DB154.DBD 70; 
 
 
 
 
	 A	 #Doseren.Doseren; 
	 A	 #Doseren.WH1_comp_geladen; 
	 A	 #Transport_ok_wh1; 
	 S	 #Doseren.Transport_wh1_set; 
 
	 A	 #Doseren.Transport_wh1_set; 
	 FP	#Doseren.FP_transport_ok_wh1; 
	 =	 #FP_uitgang_trans_ok_wh1; 
	 JCN _010; 
 
//Indien route_geladen en transport_ok weeghopper inhoud op nul zetten "zuigtransport" in volgende netwerk wordt deze waarde gebruikt om effectief te kijken wat er bij gekomen is enzo te weten wat er gedosseerd is 
// ik denk dat transport_ok altijd 1 mag zijn want route geladen is een bit die ik zelf reset en set dus zal er altijd wel een FP zijn gaan we nog zien tijdens testen 
 
	 L	 #Wh1.FB152_uitlees_waarde_Y; 
	 T	 #Doseren.Wh1_real_tarra_waarde; 
 
	 LAR1 #Dubbel_word.Dword1_1; 
	 +AR1 P#2.0; 
	 TAR1 #Dubbel_word.Dword1_1; 
 
 
_010: NOP 0; 
NETWORK
TITLE =
 
	 A	 #Doseren.Doseren; 
	 A	 #Doseren.WH1_comp_geladen; 
	 A	 #Transport_ok_wh1; 
	 AN	#Einde_doseren_comp_wh1; 
	 JCN _011; 
 
//transport_ok dan bepalen of hoog of laag waarde uit te sturen 
 
	 L	 #Wh1.FB152_uitlees_waarde_Y; 
	 L	 #Doseren.Wh1_real_tarra_waarde; 
	 -R	; 
	 T	 #Doseren.Wh1_real_waarde; 
 
	 L	 #Integer.Int1_10; 
	 L	 "Data DB UDT110".DATA_DB.Pos_fijndos_lijn1; 
	 +I	; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_15; 
 
	 L	 #Integer.Int1_10; 
	 L	 "Data DB UDT110".DATA_DB.Pos_grofdos_lijn1; 
	 +I	; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_16; 
 
	 L	 #Integer.Int1_10; 
	 L	 "Data DB UDT110".DATA_DB.Pos_fijn_gewicht_lijn1; 
	 +I	; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_17; 
 
	 L	 #Integer.Int1_10; 
	 L	 "Data DB UDT110".DATA_DB.Pos_naval_lijn1; 
	 +I	; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_18; 
 
	 L	 #Integer.Int1_10; 
	 L	 "Data DB UDT110".DATA_DB.Pos_navaltijd_lijn1; 
	 +I	; 
	 SLD 3; 
	 T	 #Dubbel_word.Dword1_19; 
 
// nu effectief het doseren 
// opvragen wat er gedosseeerd moet worden en vergelijken met naval anders alles stoppen
 
	 OPN DB [#Enkel_word.Word1_1]; 
	 L	 DBD [#Dubbel_word.Dword1_1]; 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBD [#Dubbel_word.Dword1_18]; 
	 -R	; 
	 T	 #Doseren.Gevraagd_min_naval_Wh1; 
 
	 L	 #Doseren.Wh1_real_waarde; 
	 L	 #Doseren.Gevraagd_min_naval_Wh1; 
	 >R	; 
	 JC	_111; 
 
 
	 OPN DB [#Enkel_word.Word1_1]; 
	 L	 DBD [#Dubbel_word.Dword1_1]; 
	 L	 #Doseren.Wh1_real_waarde; 
	 -R	; 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBD [#Dubbel_word.Dword1_17]; 
	 >R	; 
	 JCN _112; 
 
 
	 R	 #Lage_snelheid_wh1; 
	 L	 DBD [#Dubbel_word.Dword1_16]; 
	 T	 #Frequentie_analoog_wh1; 
	 S	 #Hoge_snelheid_wh1; 
	 JC	_113; 
 
 
_112: R	 #Hoge_snelheid_wh1; 
	 L	 DBD [#Dubbel_word.Dword1_15]; 
	 T	 #Frequentie_analoog_wh1; 
	 S	 #Lage_snelheid_wh1; 
	 JC	_113; 
 
_111: L	 0.000000e+000; 
	 T	 #Frequentie_analoog_wh1; 
	 R	 #Lage_snelheid_wh1; 
	 R	 #Hoge_snelheid_wh1; 
	 =	 #Doseren.Naval_wh1; 
	 JC	_113; 
 
_011: L	 0.000000e+000; 
	 T	 #Frequentie_analoog_wh1; 
	 R	 #Lage_snelheid_wh1; 
	 R	 #Hoge_snelheid_wh1; 
 
_113: NOP 0; 
NETWORK
TITLE =
 
	 A	 #Doseren.Naval_wh1; 
	 JCN _012; 
	 A	 #Doseren.Naval_wh1; 
	 OPN DB [#Enkel_word.Word1_2]; 
	 L	 DBW [#Dubbel_word.Dword1_19]; 
	 SD	#Naval_timer_wh1; 
_012: NOP 0; 
NETWORK
TITLE =
 
	 A	 #Naval_timer_wh1; 
	 A	 #Doseren.Doseren; 
	 A	 #Doseren.WH1_comp_geladen; 
	 A	 #Transport_ok_wh1; 
	 JCN _013; 
 
 
	 LAR1 #Dubbel_word.Dword1_1; 
	 +AR1 P#4.0; 
	 TAR1 #Dubbel_word.Dword1_1; 
 
	 L	 #Doseren.Wh1_real_waarde; 
	 OPN DB [#Enkel_word.Word1_1]; 
	 T	 DBD [#Dubbel_word.Dword1_1]; 
 
	 LAR1 #Dubbel_word.Dword1_1; 
	 +AR1 P#4.0; 
	 TAR1 #Dubbel_word.Dword1_1; 
 
	 S	 #Einde_doseren_comp_wh1; 
	 R	 #Doseren.Naval_wh1; 
	 R	 #Naval_timer_wh1; 
 
_013: NOP 0; 
NETWORK
TITLE =
 
	 A	 #Einde_doseren_comp_wh1; 
	 A	 #Doseren.Doseren; 
 
	 JCN _014; 
	 L	 0; 
	 T	 #Wh_nr_route_wh1; 
	 T	 #Silo_nr_route_wh1; 
	 T	 #Doseren.te_doseren_comp_wh1; 
	 L	 0.000000e+000; 
	 T	 #Doseren.Wh1_real_tarra_waarde; 
	 T	 #Doseren.Wh1_real_waarde; 
	 T	 #Doseren.Gevraagd_min_naval_Wh1; 
 
 
	 R	 #Doseren.Route_geladen_Wh1; 
	 R	 #Transport_ok_wh1; 
	 R	 #FP_uitgang_trans_ok_wh1; 
	 R	 #Doseren.Transport_wh1_set; 
_014: NOP 0; 
NETWORK
TITLE =
 
	 A	 #Einde_doseren_comp_wh1; 
	 A	 #Doseren.Doseren; 
	 A	 #Start_comp_wh1; 
	 JCN _015; 
	 R	 #Doseren.WH1_comp_geladen; 
	 R	 #Einde_doseren_comp_wh1; 
_015: NOP 0; 
 
NETWORK
TITLE =
 
 
END_FUNCTION_BLOCK
 
If you are going to post source code, it needs to be in absolute addressing format so it can be compiled by someone who does not have your project. Copy/paste the source to a note pad file and then attach the file for larger source codes.
 
The problem with the db is been solved by doing but now the timer is not been set in NW14

Timer is IN:timer like you can see out of declaration.
I don't use AR2 this time in the program
The timer is been resetted in NW 14 as last in the network but shouldn't it then have processed the program in that network.
I do this to create something like a FP
 
Like you requested

Thx alot allready for having a look i know you are very good in this so i appreciate this alot
 
Sorry i thougt you meant everything but only marked out that piece
So really don't jump arround
For loading the db that is not the problem i can load that value in that network also
But the L DBW [#Dubbel_word.Dword1_19] is more a problem this one is really always different.
In my case it allways calls DB202 so that i can program in there.

I tested it and it seems to work with the jump it also seemded to work at first later the problems can

But won't there be any problem if the DBW is pointing to something else the a specific timer value?

Code:
A #Doseren.Naval_wh1
JCN _012
[b]A #Doseren.Naval_wh1
OPN DB [#Enkel_word.Word1_2]
L DBW [#Dubbel_word.Dword1_19]
SD #Naval_timer_wh1
[/b]_012: NOP 0
 
And idd
It doesn't give any problem when i point it to some adress that isn't a timer value.

I hope i keeps on working

Thx alot

But ok it works but why didn't it load the db value after the jump is there any specific reason for that?
 
Have you got OB121 loaded in the plc ?

Try the following code out, on it's own, and see what happens. The timer will only work once from restarting the plc. You can reset the timer value, but that does not reset the edge detection logic for the timer:

Code:
	  A	 M	  1.0
	  JCN   nope
	  A	 M	  1.0
	  L	 S5T#4S
	  SD	T	  6
nope: NOP   0
	  A	 T	  6
	  =	 M	  1.7
	  A	 M	  1.6
	  R	 T	  6

To reset the edge detection logic, you have to use the FR instruction. Put your cursor over the SD instruction and then hit F1, read the help for more details.
 
Last edited:

Similar Topics

Which of the following input operations require a conversion to digital form prior to input? a) disk b) analog c) contact closures d) limit...
Replies
12
Views
3,824
Hey all! I recently purchased myself a Panelview Plus off of ebay and i was hoping that i could upgrade the firmware on it to Version 9 or so and...
Replies
7
Views
2,688
Good morning everyone. I am apparently confused on the COP instruction. What I am trying to do is copy a DINT to a DINT in a User Defined Data...
Replies
16
Views
6,781
Hey guys, Im currently using the above flex IO to turn on two outputs these outputs go to two flashing red beacon lights. Here's the scenario: My...
Replies
4
Views
1,680
I'm event AV Technician (Sound, Projection, and Lighting). Over the last couple of years I've used a Weigl ProCommander PHX to control some event...
Replies
9
Views
2,670
Back
Top Bottom