Trigger with Output Modes


Trigger command is used when you want to synchronize an HT start time with HT 0 in output modes. The example below shows how to synchronize HT 1 to HT 0 using trigger.

example of trigger in pulse mode

<?php
$pid0 = pid_open("/mmap/ht0");              // open HT 0
pid_ioctl($pid0, "set div us");             // set unit: microsecond
pid_ioctl($pid0, "set mode output pulse");  // set mode: pulse
pid_ioctl($pid0, "set count 10 10");        // set count values: 10 and 10
pid_ioctl($pid0, "set repc 2");             // set repeat count: 2

$pid1 = pid_open("/mmap/ht1");              // open HT 1
pid_ioctl($pid1, "set div us");             // set unit: microsecond
pid_ioctl($pid1, "set mode output pulse");  // set mode: pulse
pid_ioctl($pid1, "set trigger from ht0");   // set a target of trigger: ht0
pid_ioctl($pid1, "set count 10 10");        // set count values: 10 and 10
pid_ioctl($pid1, "set repc 1");             // set repeat count: 1

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

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

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

The output signal is as follows:

ht_set_triggerout