SER

SER, SERP, DSER, DSERP

 

SER instruction searches the source value in the specific address and saves the result in the Destination.

 

S1

Source value that you want to find out

S2

Starting address for searching

D

Destination

n

Range of search

 

Instruction

Device address

No. of Steps

Flag

M

X

Y

K

L

F

T

C

S

Z

D

@D

Int.

 

Error

Zero

Carry

SER

SERO

DSER

DSERP

S1

o

o

o

o

o

o

o

o

-

o

o

o

o

5

o

-

-

S2

o

o

o

o

o

o

-

-

-

o

o

o

-

D

o

-

o

o

o

-

-

-

-

o

o

o

-

n

o

o

o

o

o

o

o

o

-

o

o

o

o

 

SER, SERP

Format : SER S1( Source value that you want to find out) S2(Starting address for searching) D(Destination) n(range of search)

 

When enabled, the SER instruction search S1 value in the (n)number of S2 and save the result in D and D+1.

 

 

 

  • D :  It saves position number. The first 107(S1) is stored in the third of S2 so that the result is 3.

  • D+1 : It saves total number of 107(S1) in n. There are 2 107 in n so that the result is 2.

 

Error

  • If n is 0 or negative(-) value, the D holds the value and Error flag(F0110) will be set.

  • If the search range(n) is out of device address range, the Error flag(F0110) will be set and error code (F0050) will be H0403.

 

Example)

If M00 is ON, the SER instruction searches 107(D0) from D100 to D105 and saves the result in D10 and D11. Since the first 107 is stored in D101(second of D100), 2 is saved in the D10. There are two 107 in the D100 ~ D105 so 2 is saved in the D11.

 

 

 

 

 

DSER, DSERP

Format : DSER S1( Double word value that you want to find out) S2(Starting address for searching) D(Destination) n(range of search)

When enabled, the DSER instruction search S1 (DWORD value) in the (n)number of S2 and save the result in D and D+1.

 

 

 

  • D :  It saves position number. The first 5678901(S2, S1+1) is stored in the first of S2 so that the result is 1.

  • D+1 : It saves total number of 5678901 in 2n. There are 2 5678901 in 2n so that the result is 2.

 

 Error

  • If n is 0 or negative(-) value, the D holds the value and Error flag(F0110) will be set.

  • If the search range(n) is out of device address range, the Error flag(F0110) will be set and error code (F0050) will be H0403.

 

Example)

If M00 is ON, the DSER instruction searches 401289(D100) from D110 to D121 and saves the result in D90 and D91. Since the first 401289 is stored in D112 and D113(second of D110), 2 is saved in the D90. There are three 401289 in the D110 ~ D121 so 3 is saved in the D91.