ArrayArrayArrayArrayArrayArrayArray
Statistics: Posted by oxyredox — 03 Mar 2012, 12:26 Statistics: Posted by Ken29 — 14 Nov 2011, 09:59
I'll try this,
the callback procedure must be called twice (first to send 1, and next block to send 0) so I might connect the "button" output of the script to an input of the script that would inevitably cause the callback procedure to be called next block..
I'll report soon !
]]>
It can work that way with the callback procedure,
Cheers
// parameters declaration
Var InA :tParameter;
Var OutA : tParameter;
// initialisation : create parameters
procedure init;
begin
InA := Createparam('Go', ptdatafield);
SetIsOutput(InA, False);
OutA := Createparam('Resultat', PtButton);
SetIsInput(OutA, False);
end;
// Callback procedure
Procedure Callback(N:integer);
begin
If getvalue(InA)=1 then SetValue (OutA,1) else SetValue (OutA,0);
End;
]]>
Statistics: Posted by oxyredox — 11 Jul 2011, 19:38
CODE:
///////////////////////////////////////////////////////////////Bloc counter with Max Value and refresh speed///////////////////////////////////////////////////////////// If start pulse will count incremental till max value is reached// increment is timespaced of nb_blocs input.////////////////////////////////////////////////////////VAR start, counter, maxVal,counting,NB_blocs : tParameter;VAR count : Integer;///////////////////////////////////////////////////PROCEDURE Init;BEGIN start := CreateParam('start', ptButton); SetIsOutput(start, FALSE); maxVal := CreateParam('max', ptDataField); SetIsOutput(maxVal, FALSE);setValue(maxVal,16); NB_blocs := CreateParam('nb_blocs', ptDataField); SetIsOutput(NB_blocs, FALSE); setValue(Nb_Blocs,100); counter := CreateParam('counter', ptDataField); SetIsInput(counter, FALSE); counting := CreateParam('counting', ptDataField); SetIsInput(counting, FALSE);END;//PROCEDURE Callback(n : Integer);var maxvaltmp : integer;PROCEDURE Process;BEGIN IF (GetValue(start) = 1) THEN BEGIN //if start pulse of button we start the process setvalue(start,0); maxValtmp:= round(getValue(maxVal)*getValue(NB_blocs)); // we get the maxvalue to count to. we muliply by nb_blocs for the speed. //we reset count to 0 count := 0; SetValue(counting,1); //we start counting so set the parameter to 1. END ELSE BEGIN //as soon as the button went back to 0 will count. count := count + 1; END; while count > maxValtmp // if count reached maxvalue, it keeps that value do begin // and set counting parameter to 0. count := maxValtmp; SetValue(counting,0); END; SetValue(counter, count div round(getValue(NB_blocs))); //we set the value to counter output. (we divide by nb_blocs as previously multiplied the max // to get a control over refresh speed. At 1 bloc, it's the fastest possible clock in usine // that will increment each bloc (3ms at 128samples) and ensure a strong jiter free // sync over time counters. // it can be used to set some arrayvalue, dispatchers, ask osc datas ect...END;Statistics: Posted by nay-seven — 10 Jul 2011, 20:54
Statistics: Posted by oxyredox — 10 Jul 2011, 20:05
Statistics: Posted by oxyredox — 03 Mar 2012, 12:26
Statistics: Posted by Ken29 — 14 Nov 2011, 09:59
Statistics: Posted by oxyredox — 11 Jul 2011, 19:38
CODE:
///////////////////////////////////////////////////////////////Bloc counter with Max Value and refresh speed///////////////////////////////////////////////////////////// If start pulse will count incremental till max value is reached// increment is timespaced of nb_blocs input.////////////////////////////////////////////////////////VAR start, counter, maxVal,counting,NB_blocs : tParameter;VAR count : Integer;///////////////////////////////////////////////////PROCEDURE Init;BEGIN start := CreateParam('start', ptButton); SetIsOutput(start, FALSE); maxVal := CreateParam('max', ptDataField); SetIsOutput(maxVal, FALSE);setValue(maxVal,16); NB_blocs := CreateParam('nb_blocs', ptDataField); SetIsOutput(NB_blocs, FALSE); setValue(Nb_Blocs,100); counter := CreateParam('counter', ptDataField); SetIsInput(counter, FALSE); counting := CreateParam('counting', ptDataField); SetIsInput(counting, FALSE);END;//PROCEDURE Callback(n : Integer);var maxvaltmp : integer;PROCEDURE Process;BEGIN IF (GetValue(start) = 1) THEN BEGIN //if start pulse of button we start the process setvalue(start,0); maxValtmp:= round(getValue(maxVal)*getValue(NB_blocs)); // we get the maxvalue to count to. we muliply by nb_blocs for the speed. //we reset count to 0 count := 0; SetValue(counting,1); //we start counting so set the parameter to 1. END ELSE BEGIN //as soon as the button went back to 0 will count. count := count + 1; END; while count > maxValtmp // if count reached maxvalue, it keeps that value do begin // and set counting parameter to 0. count := maxValtmp; SetValue(counting,0); END; SetValue(counter, count div round(getValue(NB_blocs))); //we set the value to counter output. (we divide by nb_blocs as previously multiplied the max // to get a control over refresh speed. At 1 bloc, it's the fastest possible clock in usine // that will increment each bloc (3ms at 128samples) and ensure a strong jiter free // sync over time counters. // it can be used to set some arrayvalue, dispatchers, ask osc datas ect...END;Statistics: Posted by nay-seven — 10 Jul 2011, 20:54
Statistics: Posted by oxyredox — 10 Jul 2011, 20:05