CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 81
Текст из файла (страница 81)
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)P1 is not 000, P2 is not 000 or 010, or C is not BCD between 0001 and1000.SYNC(––) is executed when bits 08 to 15 of DM 6642 are not set forsynchronized pulse control.SYNC(––) is executed in an interrupt subroutine while a pulse I/O orhigh-speed counter instruction (INI(61), PRV(62), CTBL(63),SPED(64), PULS(65), ACC(––), PWM(––), or SYNC(––)) is beingexecuted in the main program.7-28 Special Instructions7-28-1 MESSAGE DISPLAY – MSG(46)Ladder SymbolsOperand Data AreasMSG(46)@MSG(46)FMFMFM: First message wordIR, SR, AR, DM, HR, LRLimitationsDM 6649 to DM 6655 cannot be used for FM.DescriptionWhen executed with an ON execution condition, MSG(46) reads eight words ofextended ASCII code from FM to FM+7 and displays the message on the Programming Console. The displayed message can be up to 16 characters long,i.e., each ASCII character code requires eight bits (two digits).
Refer to Appendix G for the ASCII codes. Japanese katakana characters are included in thiscode.If not all eight words are required for the message, it can be stopped at any pointby inputting “OD.” When OD is encountered in a message, no more words will be468Section 7-28Special Instructionsread and the words that normally would be used for the message can be used forother purposes.Message Buffering andPriorityUp to three messages can be buffered in memory.
Once stored in the buffer, theyare displayed on a first in, first out basis. Since it is possible that more than threeMSG(46)s may be executed within a single cycle, there is a priority scheme,based on the area where the messages are stored, for the selection of thosemessages to be buffered.The priority of the data areas is as follows for message display:LR > IR > HR > AR > TC > DMIn handling messages from the same area, those with the lowest address values have higher priority.In handling indirectly addressed messages (i.e. *DM), those with thelowest final DM addresses have higher priority.Clearing MessagesTo clear a message, execute FAL(06) 00 or clear it via a Programming Consoleor the Support Software.If the message data changes while the message is being displayed, the displaywill also change.FlagsER:ExampleThe following example shows the display that would be produced for the instruction and data given when 00000 was ON.
If 00001 goes ON, a message will becleared.Indirectly addressed DM word is non-existent. (Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)00000AddressInstructionOperandsMSG(46)DM 0010000010000000001LDMSG(46)0000200003LDFAL(06)DMFAL(06) 00DM contentsDM 00104142ASCIIequivalentABDM 00114344CDDM 00124546EFDM 00134748GHDM 0014494AIJDM 00154B4CKLDM 00164D4EMNDM 00174F50OP0000000100000100MSGABCDEFGHIJKLMNOP7-28-2 I/O REFRESH – IORF(97)Ladder SymbolOperand Data AreasSt: Starting wordIORF(97)IR 000 to IR 019StE: End wordEIR 000 to IR 019469Section 7-28Special InstructionsNote This instruction is not supported by SRM1(-V2) PCs.LimitationsSt must be less than or equal to E.DescriptionTo refresh I/O words, specify the first (St) and last (E) I/O words to be refreshed.When the execution condition for IORF(97) is ON, all words between St and Ewill be refreshed.
This will be in addition to the normal I/O refresh performed during the CPU Unit’s cycle.(If St>E, IORF(97) will be treated as NOP(00).)Normally, I/O refreshing is performed just once each cycle at the end of programexecution, but IORF(97) can be used to refresh I/O words immediately duringprogram execution.! CautionFlagsAlthough IORF(97) can be used in interrupt subroutines, you must be careful ofthe interval between IORF(97) executions.
If IORF(97) is executed to frequently,a fatal system error may occur (FALS 9F), stopping operation. The interval between executions of IORF(97) should be at least 1.3 ms + total execution time ofthe interrupt subroutine.ER:St or E is not within the allowed range (IR 000 to IR 019).St is greater than E. (If St>E, IORF(97) will be treated as NOP(00).)FlagsThere are no flags affected by this instruction.7-28-3 BIT COUNTER – BCNT(67)Operand Data AreasLadder SymbolsN: Number of words (BCD)BCNT(67)@BCNT(67)NNSBSBRRIR, SR, AR, DM, HR, TC, LR, #SB: Source beginning wordIR, SR, AR, DM, HR, TC, LRR: Destination wordIR, SR, AR, DM, HR, TC, LRNote BCNT(67) is an expansion instruction in the CPM2A/CPM2C and SRM1(-V2).The function code 67 is the factory setting and can be changed for if desired.LimitationsN cannot be 0.DM 6144 to DM 6655 cannot be used for R.DescriptionWhen the execution condition is OFF, BCNT(67) is not executed. When theexecution condition is ON, BCNT(67) counts the total number of bits that are ONin all words between SB and SB+(N–1) and places the result in R.FlagsER:N is not BCD, or N is 0; SB and SB+(N–1) are not in the same area.A DM address is used for SB, but SB through SB+(N–1) are not all inread/write DM.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)EQ:470ON when the result is 0.Section 7-28Special Instructions7-28-4 FRAME CHECKSUM – FCS(––)Operand Data AreasLadder SymbolsFCS(––)@FCS(––)CCR1R1DDC: Control dataIR, SR, AR, DM, HR, LR, #R1: First word in rangeIR, SR, AR, DM, HR, TC, LRD: First destination wordIR, SR, AR, DM, HR, LRLimitationsThis instruction is available in the CPM2A/CPM2C/SRM1(-V2) only.The 3 rightmost digits of C must be BCD between 001 and 999.DM 6144 to DM 6655 cannot be used for D.DescriptionFCS(––) can be used to check for errors when transferring data through communications ports.When the execution condition is OFF, FCS(––) is not executed. When theexecution condition is ON, FCS(––) calculates the frame checksum of the specified range by exclusively ORing either the contents of words R1 to R1+N–1 or thebytes in words R1 to R1+N–1.
The frame checksum value (hexadecimal) is thenconverted to ASCII and output to the destination words (D and D+1).The function of bits in C are shown in the following diagram and explained inmore detail below.151413121100C:Number of items in range (N, BCD)001 to 999 words or bytesFirst byte (when bit 13 is ON)1 (ON): Rightmost0 (OFF): LeftmostNot used. Set to zero.Calculation units1 (ON): Bytes0 (OFF): WordsNumber of Items in RangeThe number of items within the range (N) is contained in the 3 rightmost digits ofC, which must be BCD between 001 and 999.Calculation UnitsThe frame checksum of words will be calculated if bit 13 is OFF and the framechecksum of bytes will be calculated if bit 13 is ON.If bytes are specified, the range can begin with the leftmost or rightmost byte ofR1.
The leftmost byte of R1 will not be included if bit 12 is ON.R1R1+1R1+2R1+3MSB1357LSB2468When bit 12 is OFF the bytes will be ORed in this order: 1, 2, 3, 4, ....When bit 12 is ON the bytes will be ORed in this order: 2, 3, 4, 5, ....471Section 7-29Interrupt Control InstructionsConversion to ASCIIThe byte frame checksum calculation yields a 2-digit hexadecimal value which isconverted to its 4-digit ASCII equivalent. The word frame checksum calculationyields a 4-digit hexadecimal value which is converted to its 8-digit ASCII equivalent, as shown below.Byte frame checksum valueWord frame checksum value4AF10B3 4 4 1DFlagsER:D4 6 3 1D+13 0 4 2Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)The number of items is not 001 to 999 BCD.ExampleWhen IR 00000 is ON in the following example, the frame checksum (0008) iscalculated for the 8 words from DM 0000 to DM 0007 and the ASCII equivalent(30 30 30 38) is written to DM 0010 and DM 0011.00000@FCS(––)#0008DM 0000AddressInstruction0000000001LD@FCS(––)Operands00000#DMDMDM 0010DM 0000DM 0001DM 0002DM 0003DM 0004DM 0005DM 0006DM 000700010002000300040005000600070008000800000010FCScalculation0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 00008ASCII codeconversionDM 0010 3 0 3 0DM 0011 3 0 3 87-29 Interrupt Control InstructionsThis section describes the operation of INT(89) and STIM(69). For general information on interrupt processing in CPM1/CPM1A, CPM2A/CPM2C, orSRM1(-V2) PCs refer to the section shown in the following table.PC472ReferenceCPM1/CPM1ASee 2-3 CPM1/CPM1A Interrupt Functions.CPM2A/CPM2CSee 2-1 CPM2A/CPM2C Interrupt Functions.SRM1(-V2)See 2-4 SRM1 Interrupt Functions.Section 7-29Interrupt Control Instructions7-29-1 INTERRUPT CONTROL – INT(89)Operand Data AreasC1: Control codeLadder Symbols# (000 to 004, 100, or 200)INT(89)@INT(89)C1C1000000C2C2000: No function000C2: Control dataIR, SR, AR, DM, HR, TC, LR, #Note This instruction is not supported by SRM1(-V2) PCs.LimitationsDM 6144 to DM 6655 cannot be used for C2 when C1=002.DescriptionWhen the execution condition is OFF, INT(89) is not executed.
When the execution condition is ON, INT(89) is used to control interrupts and performs one of theseven functions shown in the following table depending on the value of C1.C1INT(89) function000Mask/unmask interrupt inputs001Clear interrupt inputs002Read current mask status of interrupt inputs003Restart decrementing counter and unmask interrupt004*Restart incrementing counter and unmask interrupt100Mask all interrupts200Unmask all interruptsNote *This setting can be used in CPM2A/CPM2C PCs only.Mask/Unmask InterruptInputs (C1=000)This function is used to mask and unmask interrupt inputs 00003 to 00006.Masked inputs are recorded, but ignored.
When an input is masked, the interruptprogram for it will be run as soon as the bit is unmasked (unless it is cleared beforehand by executing INT(89) with C1=001).Set the corresponding bit in C2 to 0 or 1 to unmask or mask an interrupt input.Bits 00 to 03 correspond to 00003 to 00006. Bits 04 to 15 should be set to 0.Word C2 bits: 3 2 1 0Interrupt input 00003 (0: unmask, 1: mask)Interrupt input 00004 (0: unmask, 1: mask)Interrupt input 00005 (0: unmask, 1: mask)Interrupt input 00006 (0: unmask, 1: mask)All of the interrupt inputs are masked at the start of PC operation, so the inputsmust be unmasked in order to be used.Clear Interrupt Inputs(C1=001)This function is used to clear interrupt inputs 00003 to 00006.