Common Commands

Commands listed in the table below are used in all modes of HT.

Command Sub Command Description
set mode output pulse set mode: output pulse
toggle set mode: output toggle
pwm set mode: output infinite pulse
capture rise set mode: capture with rising edge
fall set mode: capture with falling edge
toggle set mode: capture with rising or falling edge
div ms set unit: millisecond
us set unit: microsecond
trigger from ht0 set trigger target (should be ht0)
php set trigger target (none)
reset - reset
get state get current state
div get division rate
repc get remaining repeat count
start - start
stop - stop

Set Mode

HT provides various output modes as well as capture mode. How to set each mode is as follows:

Mode Syntax
Output pulse mode pid_ioctl($pid, "set mode output pulse");
toggle mode pid_ioctl($pid, "set mode output toggle");
pwm mode pid_ioctl($pid, "set mode output pwm");
Capture rising edge pid_ioctl($pid, "set mode capture rise");
falling edge pid_ioctl($pid, "set mode capture fall");
rising/falling edge pid_ioctl($pid, "set mode capture toggle");

Set Unit

HT provides millisecond and microsecond unit and the default value is microsecond. How to set each unit is as follows:

Unit Syntax
millisecond pid_ioctl($pid, "set div ms");
microsecond pid_ioctl($pid, "set div us");

Set Trigger

How to set trigger is as follows:

Target Syntax
ht0 pid_ioctl($pid, "set trigger from ht0");
php pid_ioctl($pid, "set trigger from php"); // No trigger target

HT0 is only option for setting HT as target of trigger in output mode. The default value is "php".


This command does:

Command Syntax
reset pid_ioctl($pid, "reset");

Get Status

This command is for getting status of HT.

Status Syntax
current state pid_ioctl($pid, "get state");
division rate pid_ioctl($pid, "get div");
remaining count of output / capture pid_ioctl($pid, "get repc");

Return values of this command are as follows:

Division Return Value Description
current state 0 stopped
1 ~ 3 running
division rate 42 microsecond
42000 millisecond
remaining count of output / capture 0 ~ 64 -


This command starts HT.

Command Syntax
start pid_ioctl($pid, "start");


Command "stop" immediately stops operation of HT. In output modes, state of output pin keeps unchanged.

Command Syntax
stop pid_ioctl($pid, "stop");