J'essai de mettre au point une boucle For pour un automate S7-1200 sur TIA V13, mais celle-ci ne fonctionne pas
Code : Tout sélectionner
FOR "Index_Month" := 1 TO 12 BY 1 DO
IF "DB_TEMPO".CPU_TIME.MONTH < "Index_Month" THEN
EXIT;
END_IF;
CASE "Index_Month" OF
1, 3, 5, 7, 8, 10, 12: // Month with 31 days
"NbDay" := "NbDay" + 31;
4, 6, 9, 11: // Month with 30 days
"NbDay" := "NbDay" + 30;
2: // february
IF #Annee_Bissextile THEN
"NbDay" := "NbDay" + 29;
ELSE
"NbDay" := "NbDay" + 28;
END_IF;
ELSE // Statement section ELSE
;
END_CASE;
END_FOR;
Index_Month (%MW4)
NbDay(%MW2)Merci
[EDIT de Brebiou] Ajout balise [codebox]

