IDEC MicroSmart User Manual

Page 336

Advertising
background image

20: P

ULSE

I

NSTRUCTIONS

20-8

« FC4A M

ICRO

S

MART

U

SER

S

M

ANUAL

»

S1+0 Output Pulse Frequency

The value stored in the data register designated by operand S1+0 determines the pulse output frequency.

0: 6.81 Hz (146.84 ms period)

1: 27.26 Hz (36.68 ms period)

2: 217.86 Hz (4.59 ms period)

S1+1 Pulse Width Ratio

The value stored in the data register designated by operand S1+1 specifies the pulse width ratio of the pulse output in per-
cent of the period determined by the output pulse frequency selected with S1+0. Valid values for operand S1+1 are 1
through 100.

S1+2 Pulse Counting

Pulse counting can be enabled for the PWM1 instruction only. With pulse counting enabled, PWM1 generates a predeter-
mined number of output pulses as designated by operands S1+3 and S1+4. With pulse counting disabled, PWM1 or
PWM2 generates output pulses while the start input for the PWM instruction remains on.

0: Disable pulse counting

1: Enable pulse counting (PWM1 only)

When programming PWM2, store 0 to the data register designated by S1+2.

S1+3 Preset Value (High Word)
S1+4 Preset Value (Low Word)

With pulse counting enabled as described above, PWM1 generates a predetermined number of output pulses as designated
by operands S1+3 and S1+4. The preset value can be 1 through 100,000,000 (05F5 E100h) stored in two consecutive data
registers designated by S1+3 (high word) and S1+4 (low word).

When pulse counting is disabled for PWM1 or when programming PWM2, store 0 to data registers designated by S1+3
and S1+4.

S1+5 Current Value (High Word)
S1+6 Current Value (Low Word)

While the PWM1 instruction is executed, the output pulse count is stored in two consecutive data registers designated by
operands S1+5 (high word) and S1+6 (low word). The current value can be 1 through 100,000,000 (05F5 E100h) and is
updated in every scan.

S1+7 Error Status

When the start input for the PWM1 or PWM2 instruction is turned on, operand values are checked. When any error is
found in the operand values, the data register designated by operand S1+7 stores an error code.

Error Code

Description

0

Normal

1

Output pulse frequency designation error (S1+0 stores other than 0 through 2)

2

Pulse width ratio designation error (S1+1 stores other than 1 through 100)

3

Pulse counting designation error (S1+2 stores other than 0 and 1)

4

Preset value designation error (S1+3 and S1+4 store other than 1 through 100,000,000)

5

Invalid pulse counting designation for PWM2 (S1+2 stores 1)

Pulse Width = Period

× Pulse Width Ratio (%)

Pulse Width

Period

Pulse

Width

Ratio

100

----------------------------------------------

×

=

1

Output

Pulse

Frequency

--------------------------------------------------------------

Pulse

Width

Ratio

100

----------------------------------------------

×

=

Period (146.84, 36.68, or 4.59 ms)

Advertising