Pwm1 (pulse width modulation 1), Pwm2 (pulse width modulation 2) – IDEC MicroSmart User Manual

Page 335

Advertising
background image

20: P

ULSE

I

NSTRUCTIONS

« FC4A M

ICRO

S

MART

U

SER

S

M

ANUAL

»

20-7

PWM1 (Pulse Width Modulation 1)

PWM2 (Pulse Width Modulation 2)

Note: The PWM1 and PWM2 instructions can be used only once in a user program. When PWM1 or PWM2 is not used,
unused output Q0 or Q1 can be used for another pulse instruction or ordinar y output.

Applicable CPU Modules

Valid Operands

Source operand S1 (control register) uses 8 data registers starting with the operand designated as S1. Data registers D0
through D1292 and D2000 through D7992 can be designated as S1. For details, see below.

Destination operand D1 (status relay) uses 3 internal relays starting with the operand designated as D1. Internal relays M0
through M1270 can be designated as D1. The least significant digit of the internal relay number designated as D1 must be
0. Special internal relays cannot be designated as D1. For details, see page 6-2.

Source Operand S1 (Control Register)

Store appropriate values to data registers starting with the operand designated by S1 before executing the PWM instruction
as required, and make sure that the values are within the valid range. Operands S1+5 through S1+7 are for read only.

FC4A-C10R2/C

FC4A-C16R2/C

FC4A-C24R2/C

FC4A-D20K3/S3

FC4A-D20RK1/RS1 & FC4A-D40K3/S3

X

X

Operand

Function

I

Q

M

R

T

C

D

Constant

Repeat

S1 (Source 1)

Control register

X

D1 (Destination 1)

Status relay

X

Operand

Function

Description

R/W

S1+0

Output pulse frequency

0: 6.81 Hz
1: 27.26 Hz
2: 217.86 Hz

R/W

S1+1

Pulse width ratio

1 to 100
(1% to 100% of the period determined by output pulse frequency S1+0)

R/W

S1+2

Pulse counting

0: Disable pulse counting
1: Enable pulse counting (PWM1 only)

R/W

S1+3

Preset value (high word)

1 to 100,000,000 (05F5 E100h) (PWM1 only)

R/W

S1+4

Preset value (low word)

S1+5

Current value (high word)

1 to 100,000,000 (05F5 E100h) (PWM1 only)

R

S1+6

Current value (low word)

S1+7

Error status

0 to 5

R

When input is on, the PWM1 instruction generates a pulse output. The output
pulse frequency is selected from 6.81, 27.26, or 217.86 Hz, and the output
pulse width ratio is determined by source operand S1.

PWM1 sends out output pulses from output Q0.

PWM1 can be programmed to generate a predetermined number of output
pulses. When pulse counting is disabled, PWM1 generates output pulses while
the star t input for the PWM1 instruction remains on.

PWM
1

S1

*****

D1

*****

When input is on, the PWM2 instruction generates a pulse output. The output
pulse frequency is selected from 6.81, 27.26, or 217.86 Hz, and the output
pulse width ratio is determined by source operand S1.

PWM2 sends out output pulses from output Q1.

PWM2 generates output pulses while the star t input for the PWM2 instruction
remains on. PWM2 cannot be programmed to generate a predetermined number
of output pulses.

PWM
2

S1

*****

D1

*****

Advertising