CTR

CTR (Count Up)

 

CTR instruction counts upward by one. When disabled, the CTR instruction retains its ACC value. Only if ACC value reaches preset value, counter device is set and ACC value is cleared.

 

 

C

Counter device address to set

V

Preset value

 

Instruction

Device address

No. of Steps

Flag

M

X

Y

K

L

F

T

C

S

Z

D

@D

Int.

Error

Zero

Carry

CTR

C

-

-

-

-

-

-

-

o

-

-

-

-

-

3

-

-

-

V

-

-

-

-

-

-

-

-

-

-

o

-

o

 

When enabled, CTR instruction increments the counter by one. Even if the CTU instruction is disabled, it retains its ACC value.

Only if ACC value reaches preset value, counter bit is set and ACC value is cleared.

The range of preset (v) : 0 ~ 65535

 

 

Example)

Whenever M00 is ON, the CTR instruction increments the counter by one. When ACC value reaches 10, C10 and Y15 will be set.

 

 

When ACC value reaches 10, Y15 is set and the ACC value is cleared.

 

 

 

When M00 is ON, C10 and Y15 are OFF and the CTR instruction counts upward by one again.