Statistics: Posted by nay-seven — 13 Jul 2014, 17:46
CODE:
// totalisateur 2 // à l'apparition d'un nouvel entier, il s'additionne algébriquement avec la valeur précédente de la sortie.// sans effet si on dépasse les limites min et max/////////////////////////// parameters declarationVar input, reset, min,max : TParameter;Var output : TParameter;var buff1 : SINGLE;var buff2 : SINGLE;var bmin : SINGLE;var bmax : SINGLE;// destroyprocedure Destroy;begin //? end;// initialisation : create parametersprocedure init;begin SetModuleColor($800080+302999); input := createParam('in',ptDataField); SetIsOutPut(input,false); reset:= CreateParam('reset',PtButton); SetIsOutput(reset,false); min := createParam('min',ptDataField); SetIsOutPut(min,false); max := createParam('max',ptDataField); SetIsOutPut(max,false); output := createParam('out',ptDataField); SetIsInPut(output,false);end;// Global variables//////////////////////////////// CallBack proc//////////////////////////////Procedure CallBack(n:integer);beginif (n = min) thenbmin := getValue(min);if (n = max) thenbmax := getValue(max);if (n = reset) then begin IF (reset >= 1) THEN buff1 := 0; buff2 := 0;end;if (n = input) then begin buff1 := getValue(input); buff2 := buff2 + buff1; if (buff2 > bmax) then buff2 := bmax; if (buff2 < bmin) then buff2 := bmin; end; SetValue(output,buff2/bmax);end;Statistics: Posted by oli_lab — 13 Jul 2014, 17:09
Statistics: Posted by nay-seven — 13 Jul 2014, 16:44

Statistics: Posted by nay-seven — 13 Jul 2014, 14:21
Statistics: Posted by beammy — 13 Jul 2014, 12:08
Statistics: Posted by nay-seven — 13 Jul 2014, 17:46
CODE:
// totalisateur 2 // à l'apparition d'un nouvel entier, il s'additionne algébriquement avec la valeur précédente de la sortie.// sans effet si on dépasse les limites min et max/////////////////////////// parameters declarationVar input, reset, min,max : TParameter;Var output : TParameter;var buff1 : SINGLE;var buff2 : SINGLE;var bmin : SINGLE;var bmax : SINGLE;// destroyprocedure Destroy;begin //? end;// initialisation : create parametersprocedure init;begin SetModuleColor($800080+302999); input := createParam('in',ptDataField); SetIsOutPut(input,false); reset:= CreateParam('reset',PtButton); SetIsOutput(reset,false); min := createParam('min',ptDataField); SetIsOutPut(min,false); max := createParam('max',ptDataField); SetIsOutPut(max,false); output := createParam('out',ptDataField); SetIsInPut(output,false);end;// Global variables//////////////////////////////// CallBack proc//////////////////////////////Procedure CallBack(n:integer);beginif (n = min) thenbmin := getValue(min);if (n = max) thenbmax := getValue(max);if (n = reset) then begin IF (reset >= 1) THEN buff1 := 0; buff2 := 0;end;if (n = input) then begin buff1 := getValue(input); buff2 := buff2 + buff1; if (buff2 > bmax) then buff2 := bmax; if (buff2 < bmin) then buff2 := bmin; end; SetValue(output,buff2/bmax);end;Statistics: Posted by oli_lab — 13 Jul 2014, 17:09
Statistics: Posted by nay-seven — 13 Jul 2014, 16:44

Statistics: Posted by nay-seven — 13 Jul 2014, 14:21
Statistics: Posted by beammy — 13 Jul 2014, 12:08