IDEC MicroSmart User Manual

Page 349

Advertising
background image

20: P

ULSE

I

NSTRUCTIONS

« FC4A M

ICRO

S

MART

U

SER

S

M

ANUAL

»

20-21

Sample Program: RAMP — Reversible Control Disabled

This program demonstrates a user program of the RAMP instruction to generate 10,000 pulses from output Q0.

Steady pulse frequency:

3,000 Hz

Initial pulse frequency:

1,000 Hz

Frequency change rate:

500 Hz / 10 ms

Reversible control enable:

Reversible control disabled

Preset value:

10,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

× 30% = 3,000 Hz

D1 (30)

S1+2

Initial pulse frequency

10,000 Hz

× 10% = 1,000 Hz

D2 (10)

S1+3

Frequency change rate

10,000 Hz

× 5% = 500 Hz

D3 (5)

S1+4

Reversible control enable

Reversible control disabled

D4 (0)

S1+5

Control direction

Not used (no effect)

D5

S1+6

Preset value (high word)

10,000

D6 (0)

S1+7

Preset value (low word)

D7 (10000)

S1+8

Current value (high word)

0 to 10,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): 30 (10,000 Hz

× 30% = 3,000 Hz)

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

× 10% = 1,000 Hz)

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

× 5% = 500 Hz)

D4 (reversible control enable): 0 (reversible control disabled)

D6 (preset value high word): 0

D7 (preset value low word): 10,000

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

I0

REP

S1 –

1

MOV(W)

D1 –

D0

REP

S1 –

30

MOV(W)

D1 –

D1

REP

S1 –

10

MOV(W)

D1 –

D2

REP

S1 –

5

MOV(W)

D1 –

D3

REP

S1 –

0

MOV(W)

D1 –

D4

D1

M100

RAMP

S1
D0

REP

S1 –

0

MOV(W)

D1 –

D6

REP

S1 –

10000

MOV(W)

D1 –

D7

Advertising