CPM2A_OPERATION MANUAL (W352-E1-3) (986749), страница 6
Текст из файла (страница 6)
Part ofthe I/O memory contains the bits that reflect the status of the PC’s inputs andoutputs. Parts of the I/O memory are cleared when the power is turned ON andother parts are retained.Note Refer to Section 3 Memory Areas in the Programming Manual (W353) for moredetails on I/O memory.Program10This is the program written by the user.
The CPM2A executes the program cyclically. (Refer to 1-3-5 Cyclic Operation and Interrupts for details.)The program can be divided broadly into two parts: the “main program” that isexecuted cyclically and the “interrupt programs” that are executed only when thecorresponding interrupt is generated.SectionStructure and OperationPC Setup1-3The PC Setup contains various startup and operating parameters.
The PC Setup parameters can be changed from a Programming Device only; they cannotbe changed from the program.Some parameters are accessed only when PC’s power supply is turned on andothers are accessed regularly while the power is on. It will be necessary to turnthe power off and then on again to enable a new setting if the parameter is accessed only when the power is turned on.Note Refer to Section 1 PC Setup in the Programming Manual (W353) for more details.Communications SwitchThe Communications Switch determines whether the peripheral port andRS-232C port operate with the standard communications settings or the communications settings in the PC Setup.1-3-2 Operating ModesCPM2A CPU Units have 3 operating modes: PROGRAM, MONITOR, and RUN.PROGRAM ModeThe program cannot be executed in PROGRAM mode. This mode is used toperform the following operations in preparation for program execution• Changing initial/operating parameters such as those in the PC Setup• Writing, transferring, or checking the program• Checking wiring by force-setting and force-resetting I/O bitsMONITOR ModeThe program is executed in MONITOR mode and the following operations canbe performed from a Programming Device.
In general, MONITOR mode is usedto debug the program, test operation, and make adjustments.• Online editing• Monitoring I/O memory during operation• Force-setting/force-resetting I/O bits, changing set values, and changing present values during operationRUN ModeThe program is executed at normal speed in RUN mode. Operations such asonline editing, force-setting/force-resetting I/O bits, and changing set values/present values cannot be performed in RUN mode, but the status of I/O bits canbe monitored.1-3-3 Operating Mode at StartupThe operating mode of the CPM2A when the power is turned on depends uponthe PC Setup settings and the Programming Console’s mode switch setting if aProgramming Console is connected.PC Setup settingWordDM6600Bits08 to 1500 to 07Programming ConsoleconnectedProgramming Consolenot connectedSetting00Startup mode determined Startup mode is RUNby the mode switchmode.
(See note.)setting.01Startup mode is the same as the operating modebefore power was interrupted.02Startup mode is determined by bits 00 to 07.00PROGRAM mode01MONITOR mode02RUN modeNote The default setting is 00. With this default setting, the startup operating mode isdetermined by the Programming Console’s mode switch setting if a Programming Console is connected to the Peripheral port. If a Programming Console isnot connected, the PC will automatically enter RUN mode.11SectionStructure and Operation1-31-3-4 PC Operation at StartupThe time required for startup initialization depends on several factors, such asthe operating conditions (including power supply voltage, system configuration,and ambient temperature) and the program contents.Time Required forInitializationPower OFF OperationMinimum Power Supply VoltageThe PC will stop and all outputs will be turned OFF if the power supply voltagefalls below 85% of the rated value.Momentary Power InterruptionA power interruption will not be detected and CPU Unit operation will continue ifthe power interruption lasts less than 10 ms for an AC power supply or 2 ms for aDC power supply.A power interruption may or may not be detected for power interruptions somewhat longer than 10 ms for an AC power supply or 2 ms for a DC power supply.When a power interruption is detected, the CPU Unit will stop operating and alloutputs will be turned OFF.Automatic ResetOperation will restart automatically when the power supply voltage is restored tomore than 85% of the rated voltage.Timing Chart of Power OFF OperationThe power interruption detection time is the time required for a power interruption to be detected after the power supply voltage drops below 85% of the ratedvalue.1, 2, 3...1.
Minimum power interruption detection timePower interruptions that are shorter than 10 ms (AC power supply) or 2 ms(DC power supply) will not be detected.2. Undetermined additional timePower interruptions only slightly longer than the minimum power interruption time may not be detected.85% of rated voltageDetection ofpower interruptionProgram execution1. Minimum time2.
AdditionaltimeExecutingStoppedCPU reset signalCPU Unit operation will CPU Unit operation maycontinue if voltage iscontinue if voltage isrestored in this region. restored in this region.Note If the power supply voltage fluctuates around 85% of the PC’s rated voltage, PCoperation may stop and restart repeatedly. When repeated stopping and startingwill cause problems with the controlled system, set up a protective circuit suchas a circuit that shuts off the power supply to sensitive equipment until the powersupply voltage returns to the rated value.12SectionStructure and Operation1-31-3-5 Cyclic Operation and InterruptsInitialization processing is performed when the power is turned on. If there are noinitialization errors, the overseeing processes, program execution, I/O refreshing, and communications port servicing are performed repeatedly (cyclically).S Check hardware.Startup initializationS Check memory.S Read data from flash memory (program,read-only DM data, and PC Setup settings).S Check for battery error.OverseeingprocessesS Preset the watch (maximum) cycle time.S Check program memory.S Refresh bits for expansion functions.Program executionPC cycle timeBasic CPU OperationCycle timecalculationS Execute the program.(Refer to the Programming Manual (W353) fordetails on cycle time and I/O response times.)S Wait for minimum cycle time if a minimumcycle time has been set in the PC Setup(DM 6619).S Calculate cycle time.S Read input data from input bits.I/O refreshingS Write output data to output bits.RS-232C portservicingS Perform RS-232C port communicationsprocessing.
(Can be changed in DM 6616.)Peripheral portservicingS Perform Peripheral port communicationsprocessing. (Can be changed in DM 6617.)The cycle time can be read from a Programming Device.AR 14 contains the maximum cycle time and AR 15 contains the present cycletime in multiples of 0.1 ms.13SectionStructure and Operation1-3The cycle time will vary slightly depending on the processing being performed ineach cycle, so the calculated cycle time will not always match the actual cycletime.Program Execution inCyclic OperationThe following diagram shows the cyclic operation of the CPM2A when the program is being executed normally.Normally, the results of program execution are transferred to I/O memory justafter program execution (during I/O refreshing), but IORF(97) can be used to refresh a specified range of I/O words during program execution.
The specifiedrange of I/O words will be refreshed when IORF(97) is executed.The cycle time is the sum of the time required for program execution, I/O refreshing, and communications port servicing.A minimum cycle time (1 to 9,999 ms) can be set in the PC Setup (DM 6619).When a minimum cycle time has been set, CPU operation is paused after program execution until the minimum cycle time is reached. CPU operation will notbe paused if the actual cycle time is longer than the minimum cycle time set inDM 6619.Note A fatal error will occur and PC operation will stop if a maximum cycle time hasbeen set in the PC Setup (DM 6618) and the actual cycle time exceeds that setting.The default settings for RS-232C port servicing and Peripheral port servicing are5% of the cycle time, but these settings can be changed (between 1% and 99%)in the PC Setup. The RS-232C port’s setting is in DM 6616 and the Peripheralport’s setting is in DM 6617.Refer to Section 7 PC Operations and Processing Time in the ProgrammingManual (W353) for more details and precautions on the cycle time.Overseeing processesMain programCycletimeIf a minimum cycle time has beenset in DM 6619, CPU operation ispaused until the minimum cycletime is reached.I/O refreshingRS-232C port servicingPeripheral port servicing14The servicing time can be setin DM 6616.The servicing time can be setin DM 6617.SectionStructure and OperationInterrupt ProgramExecution1-3When an interrupt is generated during execution of the main program, main program execution is interrupted immediately and the interrupt program is executed.
The following diagram shows the cyclic operation of the CPM2A when aninterrupt program is executed.Normally, the results of interrupt program execution are transferred to I/Omemory just after program execution (during I/O refreshing), but IORF(97) canbe used to refresh a specified range of I/O words during execution of the interrupt program. The specified range of I/O words will be refreshed when IORF(97)is executed.The normal cycle time is extended by the time required for execution of the interrupt program.Refer to Section 7 PC Operations and Processing Time in the ProgrammingManual (W353) for more details and precautions on the cycle time.Overseeing processesMain programInterrupt generated.Interrupt programCycletimeI/O refreshingRS-232C port servicingPeripheral port servicing! CautionImmediate RefreshingAlthough IORF(97) can be used in interrupt subroutines, you must be careful ofthe interval between IORF(97) executions.