Pulse Mode


Overview

This mode is used to precisely generate rectangular wave, which can be a single pulse or a chain of pulses. The pulses are identical to each other.

Waveform of ST pin will:

A block diagram of ST in pulse mode is as follows:

st_set_pulse 01

Available Commands

Command Sub Command Description
set mode output pulse set mode: pulse
div sec set unit: second
ms set unit: millisecond
us set unit: microsecond
output od open-drain
pp push-pull
low output: LOW
high output: HIGH
dev uio0 #pin set output device and pin
invert 0 not invert output
1 invert output
count [T1] [T2] set output timing parameters
delay [D] set delay
repc [N] set repeat count
trigger from st# set trigger target: st0 ~ st7
php set trigger target: none
reset - reset
get state get state
repc get remaining repeat count
start - start
stop - stop

Set Delay

This command is for giving delay before PHPoC outputs signal. The unit of delay depends on the unit which is set by "set div" command.

Command Syntax
set delay pid_ioctl($pid, "set delay D");

Set Repeat Count

In output pulse mode, this command is used to set the number of pulses.

Command Syntax Valid range of N
set repc pid_ioctl($pid, "set repc N"); 0 to 1 billion

If the command is not used, the default value is zero. Setting this value to zero means the maximum repeat count (1 billion).
(see example of waveform in "Set Count Values" section)

Set Count Values

A rectangular pulse is composed of high-level signal and low-level signal. In output pulse mode, this command is used to specify the durations signal stays in low-level and high-level during a pulse. The unit of time is specified in "set div" command.

Command Syntax
set count pid_ioctl($pid, "set count T1 T2");

Available values for count T1 and T2 in pulse mode are as follows:

Unit Available Count Values (10㎲ ~ half an hour)
microsecond 10 ~ 1,800,000,000
millisecond 1 ~ 1,800,000
second 1 ~ 1,800

This command must be used before timer starts. If not, an error is generated.
The figure below shows waveform in the case of:

st_set_pulse 02

Set Output [dev D N]

Command Syntax
set output dev D N pid_ioctl($pid, "set output dev uio0 0");

Before using output mode of ST, you must use this command to specify the output pin. Set a device name (e.g. uio0) and a pin number to D and N.

Set Output [low/high]

This command immediately forces ST pin to LOW or HIGH.

Command Syntax Description
set output low pid_ioctl($pid, "set output low"); Set ST pin to LOW
set output high pid_ioctl($pid, "set output high"); Set ST pin to HIGH

Note that if invert mode is enabled, this command will force ST pin to the state that is invert of normal operation.

Set Output [od/pp]

This command set output type of ST pin

Command Syntax Description
set output pp pid_ioctl($pid, "set output pp"); Set output type to push-pull
set output od pid_ioctl($pid, "set output od"); Set output type to open-drain

If the command is not used, the output type of ST pin is push-pull by default.

Set Output Invert [0/1]

This command is used to enable/disable invert mode.

Command Syntax Description
set output invert 0 pid_ioctl($pid, "set output invert 0"); disbale invert mode
set output invert 1 pid_ioctl($pid, "set output invert 1"); enable invert mode

When invert mode is enabled:

When the invert mode is changed (from enabled to disabled or vice versa), ST pin is toggled immediately. In other words, this command specifies the form of pulse.
There are two forms of pulse:

Invert mode is disabled by default.

Set Trigger

This command is used when you want to synchronize an ST start time with another ST. Target of trigger should be one of ST devices.

Target Syntax
ST(st0/1…) pid_ioctl($pid, "set trigger from st0");
php pid_ioctl($pid, "set trigger from php");

Default value of trigger target is "php"(no target).

Get Repeat Count

Command "get repc" is for reading the remaining repeat count which will be executed.

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

Example of Pulse Mode

example of pulse mode (normal pulse output)

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

Pulse mode basically changes level from low to high. The timing of change depends on both division rate and count values (T1 and T2). The following figure shows waveform of the example above.

st_set_pulse 03

example of pulse mode (inverted pulse output)

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

?>

After executing the command line "set output invert 1", all output levels are inverted including a pulse output. The figure below shows waveform of example above.

st_set_pulse 04