13.07.2015 Views

FX Programming Manual. - Welcome to

FX Programming Manual. - Welcome to

FX Programming Manual. - Welcome to

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>FX</strong> Series Programmable Controlers Applied Instructions 55.7.2 SER (FNC 61)<strong>FX</strong>0(S) <strong>FX</strong>0N <strong>FX</strong> <strong>FX</strong>(2C) <strong>FX</strong>2N(C)MnemonicSERFNC 61(Search aData Stack)FunctionGenerates a lis<strong>to</strong>f statisticsabout a singledata valuelocated/found ina data stackOperandsS1 S2 D nKnX, KnY,KnM, KnS,T, C, DKnX, KnY,KnM, KnS,T, C, DV, ZK, HKnY, KnM,KnST, C, DNote: 5consecutivedevicesare usedK,H, DNote:n= 1~256 for 16bit operationn= 1~128 for32 bi<strong>to</strong>perationProgram stepsSER, SERP:9 stepsDSER,DSERP:17 steps<strong>FX</strong>0(s)PULSE-P<strong>FX</strong>0N <strong>FX</strong> <strong>FX</strong>(2C) <strong>FX</strong>2N(C)Operation:The SER instruction searches a defined data stackfrom head address S1, with a stack length n. Thedata searched for is specified in parameter S2 andthe results of the search are s<strong>to</strong>red at destinationdevice D for 5 consecutive devices.DestinationdeviceDevice descriptionD Total number of occurrences of the searched value S2 (0 if no occurrences are found)D+1 The position (within the searched data stack) of the first occurrence of the searched value S2D+2 The position (within the searched data stack) of the last occurrence of the searched value S2D+3D+416 BIT OPERATION<strong>FX</strong>0(s) <strong>FX</strong>0N <strong>FX</strong> <strong>FX</strong>(2C) <strong>FX</strong>2N(C) 32 BIT OPERATION<strong>FX</strong>0(s) <strong>FX</strong>0N <strong>FX</strong> <strong>FX</strong>(2C) <strong>FX</strong>2N(C)The position (within the searched data stack) of the smallest value found in the datastack (last occurrence is returned if there are multiple occurrences of the same value)The position (within the searched data stack) of the largest value found in the data stack(last occurrence is returned if there are multiple occurrences of the same value)Points <strong>to</strong> note:a) Normal rules of algebra are used <strong>to</strong> determine the largest and smallest values, i.e. -30 issmaller than 6 etc.b) If no occurrence of the searched data can be found then destination devices D, D+1 andD+2will equal 0 (zero).c) When using data register s as the destination device D please remember that 16 bi<strong>to</strong>peration will occupy 5 consecutive, data registers but 32 bit operation will occupy 10 dataregisters in pairs forming 5 double words.d) When multiple bit devices are used <strong>to</strong> s<strong>to</strong>re the result (regardless of 16 or 32 bit operation),only the specified size of group is written <strong>to</strong> for 5 consecutive occurrences, i.e. K1Y0 wouldoccupy 20 bit devices from Y0 (K1 = 4 bit devices and there will be 5 groups for the 5results). As the maximum data stack is 256 (0 <strong>to</strong> 255) entries long, the optimum group of bitdevices required is K2, i.e. 8 bit devices.5-69

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!