CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 92
Текст из файла (страница 92)
The default function codes are given for instructions that have codes assigned by default.NameFunctionCPU UnitsPage17Code Mnemonic(@)ASFTASYNCHRONOUS SHIFTREGISTERCreates a shift register that exchanges the contents of adjacent words when one of the wordsis zero and the other is not.All38047(@)RXDRECEIVEReceives data via a communications port.All47748(@)TXDTRANSMITSends data via a communications port.All47860CMPLDOUBLE COMPARECompares two eight-digit hexadecimal values.All40661(@)INIMODE CONTROLStarts and stops counter operation, comparesand changes counter PVs, and stops pulse output.All36962(@)PRV(@)CTBL64(@)SPEDCPM2A/CPM2CCPM2A/CPM2CCPM2A/CPM2C65(@)PULSSET PULSESCPM2A/CPM2C45866(@)SCLSCALINGReads counter PVs and status data for the highspeed counter.Compares counter PVs and generates a directtable or starts operation.Outputs pulses at the specified frequency (10Hz to 50 KHz in 10 Hz units).
The output frequency can be changed while pulses are beingoutput.Outputs the specified number of pulses at thespecified frequency. The pulse output cannot bestopped until the specified number of pulseshave been output.Performs a scaling conversion on the calculatedvalue.37163HIGH-SPEED COUNTERPV READCOMPARISON TABLELOADSPEED OUTPUTAll391Use the Programming Console or SSS to access this instruction for the SRM1(-V2).67(@)BCNTBIT COUNTER68(@)BCMPBLOCK COMPARE69(@)STIMINTERVAL TIMER89(@)INTINTERRUPT CONTROL---(@)ACCACCELERATIONCONTROL---AVGAVERAGE VALUE---(@)FCSFCS CALCULATE---366460(But, Version 2 onlyfor SRM1)Counts the total number of bits that are ON inthe specified block of words.Judges whether the value of a word is within 16ranges (defined by lower and upper limits).Controls interval timers used to perform scheduled interrupts.Performs interrupt control, such as masking andunmasking the interrupt bits for I/O interrupts.Together with PULS(––), ACC(––) controls theacceleration and/or deceleration of pulses outputfrom port 1 or 2.All470All404All475CPM2A/CPM2CCPM2A/CPM2C473Adds the specified number of hexadecimalwords and computes the mean value.
Roundsoff to 4 digits past the decimal point.CPM2A/CPM2C446All471(@)HEXChecks for errors in data transmitted by a HostLink command.ASCII-TO-HEXADECIMAL Converts ASCII data to hexadecimal data.All421---(@)HMSSECONDS TO HOURSConverts second data to hour and minute data.424---(@)MAXFIND MAXIMUM---(@)MINFIND MINIMUM---(@)NEG2’S COMPLEMENTFinds the maximum value in specified data areaand outputs that value to another word.Finds the minimum value in specified data areaand outputs that value to another word.Converts the four-digit hexadecimal content ofthe source word to its 2’s complement and outputs the result to R.CPM2A/CPM2CCPM2A/CPM2CCPM2A/CPM2CAllUse the Programming Console or SSS to access this instruction for the SRM1(-V2).534(But, Version 2 onlyfor SRM1)462442444425Appendix AProgramming InstructionsCode Mnemonic---PIDNamePID CONTROLFunctionPerforms PID control based on the specifiedparameters.Use the Programming Console or SSS to access this instruction for the SRM1(-V2).---(@)PWM(@)SECPULSE WITH VARIABLEDUTY RATIOSIGNED BINARY TO BCDSCALINGBCD TO SIGNED BINARYSCALINGHOURS TO SECONDSOutputs pulses with the specified duty ratio (0%to 99%) from port 1 or 2.Linearly converts a 4-digit signed hexadecimalvalue to a 4-digit BCD value.Linearly converts a 4-digit BCD value to a 4-digitsigned hexadecimal value.Converts hour and minute data to second data.---(@)SCL2---(@)SCL3-----(@)SRCHDATA SEARCHSearches the specified range of memory for thespecified data.
Outputs the word address(es) ofwords in the range that contain the data.---(@)STUP---(@)SUMCHANGE RS-232CSETUPSUM CALCULATE---SYNCSYNCHRONIZED PULSECONTROLChanges the communications parameters in thePC Setup for a specified port.Computes the sum of the contents of the wordsin the specified range of memory.Multiplies an input pulse frequency by a fixedscaling factor and outputs pulses from the specified output bit at the resulting frequency.---TIMLLONG TIMER---TMHH---ZCP---ZCPLA decrementing ON-delay timer with SV of up to99,990 sVERY HIGH-SPEEDA high-speed, decrementing ON-delay timer thatTIMERtimes in 1-ms unitsAREA RANGE COMPARE Compares a word to a range defined by lowerand upper limits and outputs the result to theGR, EQ, and LE flags.DOUBLE AREA RANGECOMPAREUse the Programming Console or SSS to access this instruction for the SRM1(-V2).Compares an 8-digit value to a range defined bylower and upper limits and outputs the result tothe GR, EQ, and LE flags.CPU UnitsPageAll396(But, Version 2 onlyfor SRM1)CPM2A/CPM2CCPM2A/CPM2CCPM2A/CPM2CCPM2A/CPM2CCPM2A/CPM2C465All480CPM2A/CPM2CCPM2A/CPM2C448CPM2A/CPM2CCPM2A/CPM2CAll362393394423441467361407(But, Version 2 onlyfor SRM1)CPM2A/CPM2C408535Appendix BError and Arithmetic Flag OperationThe following table shows the instructions that affect the ER, CY, GT, LT and EQ flags.
In general, ER indicates thatoperand data is not within requirements. CY indicates arithmetic or data shift results. GT indicates that a comparedvalue is larger than some standard, LT that it is smaller, and EQ, that it is the same. EQ also indicates a result ofzero for arithmetic operations. Refer to Section 7 Instruction Set for details.Vertical arrows in the table indicate the flags that are turned ON and OFF according to the result of the instruction.Although ladder diagram instructions,TIM, and CNT are executed when ER is ON, other instructions with a verticalarrow under the ER column are not executed if ER is ON.
All of the other flags in the following table will also notoperate when ER is ON.Instructions not shown do not affect any of the flags in the table. Although only the non-differentiated form of eachinstruction is shown, differentiated instructions affect flags in exactly the same way.The ER, CY, GT, LT and EQ Flags are turned OFF when END(01) is executed, so their status cannot be monitoredwith a Programming Device.The status of the ER, CY, GT, LT and EQ Flags is affected by instruction execution and will change each time aninstruction that affects them is executed.
Differentiated instructions are executed only once when their executioncondition changes (ON to OFF or OFF to ON) and are not executed again until the next specified change in theirexecution condition. The status of the ER, CY, GT, LT and EQ Flags is thus affected by a differentiated instructiononly when the execution condition changes and is not affected during scans when the instruction is not executed,i.e., when the specified change does not occur in the execution condition. When a differentiated instruction is notexecuted, the status of the ER, CY, GT, LT and EQ Flags will not change and will maintain the status produced bythe last instruction that was executed.Instructions25503 (ER)TIM25504 (CY)Unaffected25505 (GR)Unaffected25506 (EQ)Unaffected25507 (LE)Unaffected25402 (N)UnaffectedCNT364END(01)OFFSTEP(08)SNXT(09)CNTR(12)TIMH(15)WSFT(16)CMP(20)UnaffectedMOV(21)MVN(22)BIN(23)OFFUnaffectedOFFUnaffectedOFFUnaffectedOFFUnaffectedUnaffectedUnaffectedUnaffectedASL(25)UnaffectedUnaffectedOFF382382409Unaffected410375OFFUnaffectedUnaffected351356356365360375402UnaffectedASR(26)ADD(30)SUB(31)OFFUnaffectedUnaffectedBCD(24)ROL(27)ROR(28)COM(29)Page359376376377450UnaffectedUnaffected427428537Appendix BError and Arithmetic Flag OperationInstructions25503 (ER)MUL(32)25504 (CY)Unaffected25505 (GR)25506 (EQ)Unaffected25507 (LE)Unaffected25402 (N)UnaffectedPage430DIV(33)431ANDW(34)ORW(35)XORW(36)XNRW(37)INC(38)451451452453453UnaffectedDEC(39)STC(40)CLC(41)MSG(46)ADB(50)SBB(51)MLB(52)DVB(53)ADDL(54)SUBL(55)MULL(56)454UnaffectedONOFFUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedDIVL(57)BCDL(59)OFF410Unaffected411UnaffectedUnaffectedUnaffectedUnaffectedUnaffected383UnaffectedUnaffectedUnaffectedUnaffectedUnaffectedBSET(71)XCHG(73)440433434436436BINL(58)XFER(70)427427468437438440384385SLD(74)378SRD(75)378MLPX(76)412DMPX(77)414SDEC(78)416DIST(80)COLL(81)MOVB(82)MOVD(83)SFTR(84)TCMP(85)ASC(86)SBS(91)MCRO(99)538UnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffected385387389390379403419455457Appendix BError and Arithmetic Flag OperationExpansion Instructions (CPM2A/CPM2C and SRM1(-V2))InstructionsASFT(17)RXD(47)TXD(48)25503 (ER)25504 (CY)UnaffectedCMPL(60)INI(61)PRV(62)CTBL(63)SPED(64)PULS(65)SCL(66)BCNT(67)BCMP(68)STIM(69)INT(89)SRCH(––)MAX(––)MIN(––)HMS(––)NEG(––)*SEC(––)SUM(––)FCS(––)HEX(––)AVG(––)PID(––)ZCP(––)25505 (GR)Unaffected25506 (EQ)Tnaffected25507 (LE)Unaffected25402 (N)UnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedUnaffectedPage380477478406369371366460458391470404475473441442444424425423448471421446396407Note *Depending on the results, NEG(––) may also affect the status of the underflow flag (SR 25405).Expansion Instructions (CPM2A/CPM2C Only)InstructionsPWM(––)ZCPL(––)ACC(––)SCL2(––)SCL3(––)SYNC(––)25503 (ER)25504 (CY)25505 (GR)25506 (EQ)25507 (LE)PageUnaffectedUnaffectedUnaffectedUnaffected465408462UnaffectedUnaffected393Unaffected394394539Appendix CMemory AreasCPM1/CPM1A Memory AreasMemory Area StructureThe following memory areas can be used with the CPM1/CPM1A.Data areaIR area1 Input areaOutput areaWork areaSR areaTR areaHR area2AR area2LR area1Timer/Counter area2DM area Read/write2WordsIR 000 to IR 009(10 words)IR 010 to IR 019(10 words)IR 200 to IR 231(32 words)SR 232 to SR 255(24 words)---DM 0000 to DM 0999 --DM 1022 to DM 1023(1,002 words)Error log2DM 1000 to DM 1021 --(22 words)Read-only4DM 6144 to DM 6599 --(456 words)DM 6600 to DM 6655 --(56 words)PC Setup4BitsIR 00000 to IR 00915(160 bits)IR 01000 to IR 01915(160 bits)IR 20000 to IR 23115(512 bits)SR 23200 to SR 25515(384 bits)TR 0 to TR 7(8 bits)HR 00 to HR 19HR 0000 to HR 1915(20 words)(320 bits)AR 00 to AR 15AR 0000 to AR 1515(16 words)(256 bits)LR 00 to LR 15LR 0000 to LR 1515(16 words)(256 bits)TC 000 to TC 127 (timer/counter numbers)3FunctionThese bits can be allocated to the externalI/O terminals.Work bits can be freely used within the program.These bits serve specific functions such asflags and control bits.These bits are used to temporarily storeON/OFF status at program branches.These bits store data and retain their ON/OFF status when power is turned off.These bits serve specific functions such asflags and control bits.Used for a 1:1 data link with another PC.The same numbers are used for both timersand counters.DM area data can be accessed in wordunits only.