Common Commands


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

Command Sub Command Description
set mode free set mode: free
output pulse set mode: output pulse
toggle set mode: output toggle
pwm set mode: output infinite pulse
div sec set unit: second
ms set unit: millisecond
us set unit: microsecond
reset - reset
get state get current state
start - start
stop - stop

Set Mode

ST provides both normal counter mode (free mode) and output signal mode. There are three output modes and those are pulse, toggle and pwm. The pwm is infinite pulse mode. Default value of ST mode is free mode. The following table shows how to set ST to each mode.

Mode Syntax
free pid_ioctl($pid, "set mode free");
pulse pid_ioctl($pid, "set mode output pulse");
toggle pid_ioctl($pid, "set mode output toggle");
pwm pid_ioctl($pid, "set mode output pwm");

Set Unit

ST provides three units as follows. The default value is millisecond.

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

Reset

This command does:

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

Get State

This command gets the current state of ST.

Command Syntax
get state pid_ioctl($pid, "get state");

Return values of this command are as follows:

Return Value Description
0 Stop
1 ~ 5 Running

Start

This command starts ST.

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

Stop

This command immediately stops operation of ST. In output modes, state of output pin keeps the current state.

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