CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 12
Текст из файла (страница 12)
It is also possible to start thecomparison along with the registration.Register Target Value Comparison Table(@)CTBL(63)000002SPort specifier (000: High-speed counter)Mode designation (002: Register target value comparison table only)Beginning word of comparison table49SectionCPM2A/CPM2C High-speed Counters2-2Register Target Value Comparison Table and Start Comparison(@)CTBL(63)Port specifier (000: High-speed counter)Mode designation (000: Register target value comparison tableand start comparison)000000SBeginning word of comparison tableTarget Value Comparison TableNumber of comparisonsNumber of comparisons0001 to 0016 BCDTarget value 1 (rightmost)Target value (rightmost, leftmost)Target value 1 (leftmost)Comparison 1 settingRegister the counter value to be compared.The leftmost digit shows the sign (+/–).Subroutine numberDifferential phase input modePulse + direction input modeTarget value 2 (rightmost)Target value 2 (leftmost)Up/down pulse input modeF8388608 to 08388607Comparison 2 settingSubroutine numberIncrement mode00000000 to 16777215Subroutine numberRegister the direction of comparison and the subroutinenumber to be executed when there is a match.The leftmost digit shows the direction (increment/decrement).Increment direction: 0000 to 0049Decrement direction: F000 to F049It is not possible to specify more than one comparison direction condition for thesame target value in the comparison table.Once a comparison table has been registered, it will be saved in the CPM2A/CPM2C as long as no other comparison table is registered and the mode is notchanged to PROGRAM mode (and as long as the power is not turned OFF).Register Range Comparison TableRegister Range Comparison Table and Start ComparisonThese functions register a comparison table to the CPM2A/CPM2C for the purpose of count checking in range comparison.
It is also possible to start the comparison along with the registration.Register Range Comparison Table(@)CTBL(63)Port specifier (000: High-speed counter)Mode designation (003: Register range comparison table only)Beginning word of comparison table000003SRegister Range Comparison Table and Start Comparison(@)CTBL(63)000001S50Port specifier (000: High-speed counter)Mode designation (001: Register range comparison tableand start comparison)Beginning word of comparison tableSectionCPM2A/CPM2C High-speed Counters2-2Range Comparison TableEight range comparison conditions consisting of upperand lower limits and subroutine numbers must be set.Lower limit 1 (rightmost)Lower limit 1 (leftmost)Upper limit 1 (rightmost)Range comparisoncondition 1Upper limit 1 (leftmost)Upper and lower limits (rightmost, leftmost)Register the upper and lower limits.The leftmost digit shows the sign (+/–).Differential phase input modePulse + direction input modeSubroutine numberUp/down pulse input modeF8388608 to 08388607Increment mode00000000 to 16777215Subroutine numberRegister the subroutine number to be executed whenthe range comparison condition is satisfied.Lower limit 8 (rightmost)Lower limit 8 (leftmost)Upper limit 8 (rightmost)0000 to 0049Range comparisoncondition 8If the set values do not reach 8, set FFFF.Upper limit 8 (leftmost)Subroutine numberIf two or more comparison conditions are satisfied simultaneously (in the samecycle), the interrupt for the condition closest to the beginning of the comparisontable will be executed.Once a comparison table has been registered, it will be saved in the CPM2A/CPM2C as long as no other comparison table is registered and the mode is notchanged to PROGRAM mode (and as long as the power is not turned OFF).Start/Stop ComparisonThe comparison can be started or stopped according to the table that has already been registered to the CPM2A/CPM2C by CTBL(63).Start Comparison(@)INI(61)000Port specifier (000: High-speed counter)000Control designation (000: Start comparison)Fixed: 000000Stop Comparison(@)INI(61)000001Port specifier (000: High-speed counter)Control designation (001: Stop comparison)000Fixed: 00051SectionCPM2A/CPM2C High-speed Counters2-2Change PVThis function changes the high-speed counter PV.(@)INI(61)000Port specifier (000: High-speed counter)002Control designation (002: Change PV)Beginning word of PV data to changeC2Rightmost 4 digitsC2Leftmost 4 digitsC2+1PV data to change (Rightmost and leftmost)Register the PV data to be changed.The leftmost digit shows the sign (+/–).Differential phase input modePulse + direction input modeUp/down pulse input modeF8388608 to 08388607Increment mode00000000 to 16777215No interrupt will occur during a target value comparison even if the target valueregistered in the comparison table is changed by INI(61).Read PVThis function reads the high-speed counter PV.Using an Instruction(@)PRV(62)000Port specifier (000: High-speed counter)002Control designation (000: Read PV)Beginning word for storing PVC2DRightmost 4 digitsD+1Leftmost 4 digitsPV (Rightmost and leftmost)The read PV will be stored here.The leftmost digit shows the sign (+/–).Differential phase input modePulse + direction input modeUp/down pulse input modeF8388608 to 08388607Increment mode00000000 to 16777215Using Data AreasThe high-speed counter PV is stored in words 248 and 249 as shown below.SR 248PV (Rightmost word)SR 249PV (Leftmost word)Words 248 and 249 are refreshed with every scan, so there may be a discrepancy from the exact PV at any given time.When the high-speed counter is not used, words 248 and 249 can be used aswork words.When the PV is read by executing PRV(62), words 248 and 249 are refreshedwith the same timing.52SectionCPM2A/CPM2C High-speed Counters2-2Read StatusThis function reads the high-speed counter status, such as whether a comparison operation is in progress or whether an overflow or underflow has occurred.Using an Instruction(@)PRV(62)000Port specifier (000: High-speed counter)001Control designation (001: Read status)DWord for storing statusOverflow/underflow0: Normal1: Overflow/underflowComparison0: Stopped1: In progressUsing Data AreasThe status is stored in AR 1108 and AR 1109 as shown below.Overflow/underflow0: Normal1: Overflow/underflowComparison0: Stopped1: In progressAR 1108 and AR 1109 are refreshed with every scan, so there may be a discrepancy from the exact status at any given time.When the status is read by executing PRV(62), AR 1108 and AR 1109 are refreshed with the same timing.Read Range Comparison ResultThis function reads the result of a range comparison showing whether or not thePV is within a range.Using an Instruction(@)PRV(62)000002DPort specifier (000: High-speed counter)Control designation (002: Read range comparison result)Beginning word for storing range comparison resultMatch with 1st condition (0: No match; 1: Match)Match with 2nd condition (0: No match; 1: Match)Match with 3rd condition (0: No match; 1: Match)Match with 4th condition (0: No match; 1: Match)Match with 5th condition (0: No match; 1: Match)Match with 6th condition (0: No match; 1: Match)Match with 7th condition (0: No match; 1: Match)Match with 8th condition (0: No match; 1: Match)Using Data AreasThe range comparison result is stored in AR 1100 through AR 1107, as shownbelow.Match with 1st condition (0: No match; 1: Match)Match with 2nd condition (0: No match; 1: Match)Match with 3rd condition (0: No match; 1: Match)Match with 4th condition (0: No match; 1: Match)Match with 5th condition (0: No match; 1: Match)Match with 6th condition (0: No match; 1: Match)Match with 7th condition (0: No match; 1: Match)Match with 8th condition (0: No match; 1: Match)53SectionCPM2A/CPM2C High-speed Counters2-2AR 1100 through AR 1107 are refreshed with every scan, so there may be a discrepancy from the exact PV range comparison result at any given time.When the range comparison result is read by executing PRV(62), AR 1100through AR 1107 are refreshed with the same timing.Mask/Unmask All InterruptsFor details regarding masking and unmasking all interrupts, refer to 2-1-1 Interrupt Inputs.Application ExamplesTarget Value ComparisonExplanationIn this example, specified interrupt subroutines are executed by matching thehigh-speed counter’s PV with five values set as a target value comparison table.With each interrupt, the data in DM 0000 to DM 0004 is incremented by one.Wiring (CPM2A)OrangeE6B2-CWZ6CRotary EncoderWhiteBlackBlueBrown54SectionCPM2A/CPM2C High-speed Counters2-2Wiring (CPM2C)Input terminalsBlueRotary encoderBrownOrangeWhiteBlackInput connectorBlueRotary encoderBrownOrangeWhiteBlackPC Setup15DM 6642001000: Differential phase input0: Reset by phase-Z signal + software reset01: Use as high-speed counter55SectionCPM2A/CPM2C High-speed CountersProgrammingON for 1 cycle at beginningof operation(71)(63) Register target value comparison table and begin comparisonHigh-speed counterRegister target value comparison table and begin comparisonBeginning word of comparison tableNumber of comparisons: 5(92)Target value:00010000Always ON(38)Comparison 2Comparison 1Increment, subroutine 049Target value:00003000Comparison 2Increment, subroutine 040Target value:00000000(93)Comparison 3Decrement, subroutine 010(92)Target value:00003000Always ONComparison 4Decrement, subroutine 041(38)Comparison 4Target value:00010000Comparison 5Decrement, subroutine 048(93)(92)Always ON(38)Comparison 5(93)(92)Always ON(38)Comparison 1(93)(92)Always ON(38)(93)(01)56Comparison 32-2SectionCPM2A/CPM2C High-speed Counters2-2Range ComparisonExplanationIn this example, specified interrupt subroutines are executed by matching thehigh-speed counter’s PV with five range set as a range comparison table.