IDEC MicroSmart User Manual

Page 351

Advertising
background image

20: P

ULSE

I

NSTRUCTIONS

« FC4A M

ICRO

S

MART

U

SER

S

M

ANUAL

»

20-23

Sample Program: RAMP — Reversible Control with Dual Pulse Output

This program demonstrates a user program of the RAMP instruction to generate 30,000 pulses from output Q0 (forward
pulse) or Q1 (reverse pulse) while input I1 is off or on, respectively.

Steady pulse frequency:

5,000 Hz

Initial pulse frequency:

2,000 Hz

Frequency change rate:

100 Hz / 10 ms

Reversible control enable:

Reversible control with dual pulse output

Preset value:

30,000 pulses total

Operand Settings

Operand

Function

Description

Allocation No. (Value)

S1+0

Operation mode

Frequency range 100 to 10,000 Hz

D0 (1)

S1+1

Steady pulse frequency

10,000 Hz

× 50% = 5,000 Hz

D1 (50)

S1+2

Initial pulse frequency

10,000 Hz

× 20% = 2,000 Hz

D2 (20)

S1+3

Frequency change rate

10,000 Hz

× 1% = 100 Hz

D3 (1)

S1+4

Reversible control enable

Reversible control with dual output

D4 (2)

S1+5

Control direction

0 (for ward) or 1 (reverse)

D5 (0 or 1)

S1+6

Preset value (high word)

30,000

D6 (0)

S1+7

Preset value (low word)

D7 (30000)

S1+8

Current value (high word)

0 to 30,000

D8

S1+9

Current value (low word)

D9

S1+10

Error status

D10

D1+0

Pulse output ON

0: Pulse output OFF
1: Pulse output ON

M100

D1+1

Pulse output complete

0: Pulse output not complete
1: Pulse output complete

M101

D1+2

Pulse output status

0: Steady pulse output
1: Changing output pulse frequency

M102

D1+3

Pulse output over flow

0: Over flow not occurred
1: Over flow occurred

M103

M8120

M8120 is the initialize pulse special internal relay.

When the CPU star ts, seven MOV(W) instructions store parameters to
data registers D0 through D7.

D0 (operation mode): 1 (100 to 10,000 Hz)

D1 (steady pulse frequency): 50 (10,000 Hz

× 50% = 5,000 Hz)

D2 (initial pulse frequency): 20 (10,000 Hz

× 20% = 2,000 Hz)

D3 (frequency change rate): 1 (10,000 Hz

× 1% = 100 Hz)

D4 (reversible control enable): 2 (reversible control with dual output)

D6 (preset value high word): 0

D7 (preset value low word): 30,000

When input I1 is off, D5 (control direction) stores 0 (for ward).

When input I1 is on, D5 (control direction) stores 1 (reverse).

When star t input I0 is turned on, RAMP star ts to generate 30,000 output
pulses.

I0

REP

S1 –

1

MOV(W)

D1 –

D0

REP

S1 –

50

MOV(W)

D1 –

D1

REP

S1 –

20

MOV(W)

D1 –

D2

REP

S1 –

1

MOV(W)

D1 –

D3

REP

S1 –

2

MOV(W)

D1 –

D4

D1

M100

RAMP

S1
D0

REP

S1 –

0

MOV(W)

D1 –

D6

REP

S1 –

30000

MOV(W)

D1 –

D7

REP

S1 –

0

MOV(W)

D1 –

D5

REP

S1 –

1

MOV(W)

D1 –

D5

I1

I1

Advertising