Trigger


Trigger command is used when you want to synchronize an ST start time with another ST. The example below shows how to synchronize ST1 to ST0 using trigger.

example of trigger

<?php
$pid0 = pid_open("/mmap/st0");              // open ST 0
pid_ioctl($pid0, "set div sec");            // set unit: second
pid_ioctl($pid0, "set mode output pulse");  // set mode: pulse
pid_ioctl($pid0, "set count 1 1");          // set count values: 1 and 1
pid_ioctl($pid0, "set repc 2");             // set repeat count: 2
pid_ioctl($pid0, "set output dev uio0 0");  // set output dev / pin: uio0 / 0

$pid1 = pid_open("/mmap/st1");              // open ST 1
pid_ioctl($pid1, "set div sec");            // set unit: second
pid_ioctl($pid1, "set mode output pulse");  // set mode: pulse
pid_ioctl($pid1, "set trigger from st0");   // set trigger target: st0
pid_ioctl($pid1, "set count 1 1");          // set count values: 1 and 1
pid_ioctl($pid1, "set repc 2");             // set repeat count: 2
pid_ioctl($pid1, "set output dev uio0 1");  // set output dev / pin: uio0 / 1

pid_ioctl($pid1, "start");                  // start ST 1
pid_ioctl($pid0, "start");                  // start ST 0

while(pid_ioctl($pid1, "get state"));
pid_close($pid0);
pid_close($pid1);
?>

As you see the example above, ST which you want to synchronize the output time should start before the trigger target starts.

The output is as follows:

st_set_trigger_01

error range of ST

ST leads some error ranges and those are as follows:

Case Error Range
Simultaneously use 2 STs approximately 1㎲
Simultaneously use 8 STs approximately 4㎲

※ Use HT if you need the high accuracy.