beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 569

background image

9 Application Instructions API 150-199

DVP-PLC Application Manual

9-97

Program Example:

1. Assume we adopt X0 as the external interruption, together with I001 (rising-edge trigger) interruption program;

target number of feedbacks = 50,000; target frequency = 10KHz; Y0, Y1 (CH0) as output pulses; start/end

frequency (D1340) = 200Hz; acceleration time (D1343) = 300ms; deceleration time (D1348) = 600ms;

percentage value (D1198) = 100; current number of output pulses (D1336, D1337) = 0.

2. Write the program codes as follows:

M1002

M1000

M0

I 010

MOV

K100

D1198

K300

D1343

K600

D1348

SET

DMOV

K0

D1336

M1534

RST

C251

EI

DCNT

C251

K100000

DCLLM

X0

K50000

K100000

Y0

FEND

INC

D0

IRET

END

MOV

MOV

3. Assume the first execution result as:

100KHz

D1340

D1348

D1343

X0 Off --> On

Frequency

Y0 stops output

Time
Number

Estimated number of output pulses: 50,000

Actual number of output pulses (D1336, D1337) = K49,200

4. Observe the result of the first execution:

a) The actual output number 49,200 – estimated output number 50,000 = -800 (a negative value). A negative

value indicates that the entire execution finishes earlier and has not completed yet.

b) Try to shorten the acceleration time (D1343) into 250ms and deceleration time (D1348) into 550ms.