Page 1 of 1

How to trig in fastscript… ?

Posted: 17 Jun 2022, 11:35
by Vincent
Hi!

In a script, I'm wondering how to send a trig signal to a trig output:

Code: Select all

// trigger output
TrigNext := CreateParam('trig next',ptButton,pioOutput);
I suppose I should insert something like a "doevents" between "TrigNext.asInteger(1);" and "TrigNext.asInteger(0);", but I don't know how to code that.

Code: Select all

TrigNext.asInteger(1);
// something to insert here, but what?
TrigNext.asInteger(0);
I did not find a page with some infos on procedures and functions…

Thanks for the help.
Have a good day.

Vincent

Re: How to trig in fastscript… ?

Posted: 18 Jun 2022, 01:43
by sm_jamieson
As I understand it, a "trigger" is when the output value goes to 1 for one processing bloc (possibly several blocks would be OK),
then back to 0.
The Process procedure is called once per processing bloc.
So you cannot do it in a single call to Process. You need to set the trigger output to 1 and also set a flag that will tell you to set
it back to 0 on the next call to Process.

This also implies you cannot have a trigger every bloc, you need 2 blocs to complete the trigger.
I'm not sure at what precise instant in the 1,0 sequence the trigger actually occurs.

Simon.

Re: How to trig in fastscript… ?

Posted: 19 Jun 2022, 09:31
by senso
yes it has to be handled by the Process procedure

Code: Select all

// flag
var sendTrigger:boolean;

Procedure Process;
begin
      if sendTrigger
      then begin
            TrigNext.asInteger(1);
            sendTrigger := false;
      end
      else TrigNext.asInteger(0);

end;

Re: How to trig in fastscript… ?

Posted: 30 Jun 2022, 22:05
by Vincent
Hi my friends,

Sorry for the delay: I did not recieve any alert... maybe a small bug in the forum...

Thanks anyway for your answers.
And yes of course, I understand now it has to be handled by the Process procedure!

Have a good day.

V