CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 18
Текст из файла (страница 18)
When C2 is entered as a constant:The settings are the same as for the one-shot mode, but interrupts will continue to be repeated at fixed intervals until the operation is stopped.Reading the Timer’s Elapsed TimeUse the STIM(69) instruction to read the timer’s elapsed time.(@)STIM(69)C1C2C3C1: Read elapsed time (006)C2: Leading word of parameter 1C3: Parameter 2C2: Number of times the decrementing counter has been decremented (4 digitsBCD)C2 + 1: Decrementing counter time interval (4 digits BCD; unit: 0.1 ms)C3: Elapsed time from previous decrement (4 digits BCD; unit: 0.1 ms)The time from when the interval timer is started until the execution of this instruction is calculated as follows:{(Content of C2) × (Content of C2+1) + (Content of C3)} × 0.1 msIf the specified interval timer is stopped, then “0000” will be stored.Stopping the TimerUse the STIM(69) instruction to stop the interval timer.
The interval timer will bestopped.(@)STIM(69)C1C1: Stop interval timer (010)00000087SectionSRM1(-V2) Interrupt FunctionsApplication Example(One-shot Mode)2-4In this example, an interrupt is generated 2.4 ms (0.6 ms × 4) after input 00005goes ON; the interrupt executes interrupt subroutine number 23.25315 First Cycle FlagON for 1 cycleMOV(21)#0004DM 0010Sets the decrementing counter‘s set value to 4.(BCD: 0000 to 9999)MOV(21)#0006DM 0011Sets the decrementing time interval to 0.6 ms.(BCD: 0005 to 0320)00005@STIM(69)000SBN(92)Starts the interval timer in one-shot mode.DM 0010Specifies the first word containing the set value.#0023Specifies the subroutine number (only lower bytes are effective).023Interrupt programRET(93)Application Example(Scheduled Interrupt Mode)In this example, an interrupt is generated every 4.0 ms (1.0 ms × 4) after input00005 goes ON; the interrupts execute interrupt subroutine number 23.25315 First Cycle FlagON for 1 cycleMOV(21)#0004DM 0010Sets the decrementing counter‘s set value to 4.(BCD: 0000 to 9999)MOV(21)#0010DM 0011Sets the decrementing time interval to 1.0 ms.(BCD: 0005 to 0320)00005@STIM(69)003DM 0010#0023SBN(92)Starts the interval timer in scheduled interrupt mode.Specifies the first word containing the set value.Specifies the subroutine number (only the lower bytes are effective).023Interrupt programRET(93)88SectionCPM2A/CPM2C Pulse Output Functions2-52-5CPM2A/CPM2C Pulse Output FunctionsThe CPM2A/CPM2C has two pulse outputs.
By means of a selection in the PCSetup, these outputs can be used as two single-phase outputs without acceleration and deceleration, two variable duty ratio pulse outputs, or pulse outputs withtrapezoidal acceleration/deceleration (one pulse + direction output and one up/down pulse output). The pulse output PV coordinate system can also be specified in the PC Setup as either relative or absolute.There are two pulse output modes: Independent mode, in which outputs arestopped at a preset amount of pulses, and continuous mode, in which outputsare stopped by an instruction.Note To use pulse outputs, it is necessary to use a CPU Unit with transistor outputs,i.e., either a CPM2A-CDT-D or CPM2A-CDT1-D.The following diagram shows the configuration for a CPM2A, but the configuration for a CPM2C is identical.Stepping motorMotorcontrollerPulse outputsItemExecution instructionsOutputnumber0100001001Output frequency rangePitchSingle-phasepulse outputswithoutaccel/decelVariable dutyratio pulseoutputsSingle-phase pulse outputs with trapezoidalacceleration/decelerationPULS(65) andSPED(64)Pulse output 0(See note 1.)Pulse output 1(See note 1.)10 Hz to 10 kHzPWM(––)Pulse + directionoutputsPULS(65) and ACC(––)Up/down pulseoutputsPulse output 0(See note 1.)Pulse output 1(See note 1.)0.1 to 999.9 HzPulsePulse outputoutput 0Directionoutput10 Hz to 10 kHzPulseCW pulseoutput 0 outputCCW pulseoutput10 Hz to 10 kHz10 Hz0.1 Hz10 Hz10 HzUp/down frequency pitch------10 Hz (See note 2.)10 Hz (See note 2.)Start speed pitch------10 Hz10 HzOutput modeContinuous,Independent1 to 16777215Continuous---Continuous,Independent±1 to 16777215Continuous,Independent±1 to 1677721550%0 to 100%50%50%YesNoYesYesNoNoYesYesNoNoYesYesNoYesNoNoNumber ofpulsesDuty ratio (See note 3.)ControlMovementmethodspecificationAccel/decelspecificationStart speedspecificationDutyspecification89SectionCPM2A/CPM2C Pulse Output FunctionsNote2-51.
With single-phase pulse outputs, pulse outputs 0 and 1 can each be outputindependently.2. Pulse outputs can be accelerated or decelerated in units of 10 Hz every 10ms.3. Actual pulses are affected by the transistor output’s ON response time (20µs max.) and OFF response time (40 µs max.).The following table shows the relationships between the high-speed counterand the CPM2A/CPM2C’s other functions.Interval timer interruptsSynchronized pulse controlCannot be used simultaneously.Interrupt inputsCan be used simultaneously.Interval timer interruptsCan be used simultaneously.High-speed countersCan be used simultaneously.Interrupt inputs (counter mode)Can be used simultaneously.Pulse outputsSee note.Quick-response inputsCan be used simultaneously.Input time constantCan be used simultaneously.ClockCan be used simultaneously.Note The number of simultaneous outputs varies according to the type of pulse output, as shown in the following table.CombinationSingle-phase pulse outputFixed duty ratioSingle-phase Fixed duty Can use two pointspulse output ratiosimultaneously(independently).Variableduty ratioVariable duty ratioCan use one point at atime (independently).Pulse + directionoutputUp/down pulseoutputCannot be used.Cannot be used.Can use one point at atime (independently).Can use two pointssimultaneously(independently).Cannot be used.Cannot be used.Pulse + direction outputCannot be used.Cannot be used.Cannot be used.Cannot be used.Up/down pulse outputCannot be used.Cannot be used.Cannot be used.Cannot be used.Up to two points can be output simultaneously with only single-phase pulse outputs, so two-point output is possible when fixed duty ratio and variable duty ratioare used in combination.Outputs are possible for only one point at a time with pulse + direction outputsand up/down pulse outputs, so no other pulses can be output.Types of Pulse OutputsThere are three types of pulse outputs: Single-phase pulse outputs without acceleration and deceleration, variable duty ratio pulse outputs, and single-phasepulse outputs with trapezoidal acceleration and deceleration.Single-phase Pulse Outputs Without Acceleration and Deceleration90• Frequency:10 Hz to 10 kHz (Set in units of 10 Hz.)• Output destination:Output number 01000 (Word 010, bit 00)Output number 01001 (Word 010, bit 01)(Pulses can be output simultaneously and independently from two points.• Output mode:Continuous or Independent• Number of pulses:1 to 16,777,215SectionCPM2A/CPM2C Pulse Output Functions• Instructions:2-5PULS(65) and SPED(64)• With PULS(65), the number of pulses is set for each point (in independentmode only).• With SPED(64), the output mode and target frequency are set for eachpoint, and pulses are output.Instruction execution: PULS(65) + SPED(64) (Independent mode)Independent modeNumber of set pulsesThe output is stopped automatically when the set number of pulses has been output.Instruction execution: SPED(64) (Continuous mode)Continuous modePulses continue to be output at the set frequency until stopped by the instruction.Variable Duty Ratio Pulse Outputs• Duty ratio:0% to 100% (Set in units of 1%.)• Frequency:0.1 to 999.9 Hz (Set in units of 0.1 Hz.)• Output destination:Output number 01000 (Word 010, bit 00)Output number 01001 (Word 010, bit 01)(Pulses can be output simultaneously and independently from two points.)• Output mode:Continuous• Instruction:PWM(––)With PWM(––), pulses are output with a variable duty ratio.tonInstruction execution: PWM(––)Pulses are output at the set frequency until stopped.Duty ratio (D) =tonTSingle-phase Pulse Outputs With Trapezoidal Acceleration/Deceleration• Frequency:10 Hz to 10 kHz (Set in units of 10 Hz.)• Acceleration/deceleration rate: 10 Hz/10 ms to 10 kHz/10 ms (Set in units of10 Hz.)Pulse + Direction Outputs• For CW Output:Output number 01001 (Word 010, bit 01) turned OFF.Pulses output from output number 01000 (Word 010, bit 00).• For CCW Output:Output number 01001 (Word 010, bit 01) turned ON.Pulses output from output number 01000 (Word 010, bit 00).01000Pulse outputs01001Direction outputs (OFF: CW operation; ON: CCW operation)91SectionCPM2A/CPM2C Pulse Output Functions2-5Up/Down Pulse Outputs• For CW output:Pulses output from output number 01000 (Word 010, bit 00).• For CCW output:Pulses output from output number 01001 (Word 010, bit 01).01000CW operation01001CCW operation• Output mode: Continuous and Independent• Number of pulses: 1 to 16,777,215• Instructions:PULS(65) and ACC(––)• With PULS(65), the number of pulses is set (in independent mode only).• With ACC(––), the output mode, starting frequency, target frequency, andacceleration/deceleration rate are set, and the pulse outputs are started.From when the pulse outputs are started until they are stopped, they arecontrolled at a constant-ratio frequency change.Independent ModePulse output frequencyInstruction execution: PULS(65) + ACC(––) (Independent mode)In independent mode, deceleration iscarried out at the acceleration/deceleration rate in effect at the start.TargetfrequencyStartingfrequencyTime0 HzAccelerationStartDecelerationACC(––)Continuous ModePulse output frequencyInstruction execution: ACC(––) (Continuous mode)Targetfrequency 2Targetfrequency 3Targetfrequency 10 HzTimeAcceleration/deceleration Acceleration/deceleration Acceleration/decelerationStartAcceleration orAcceleration ordecelerationdecelerationACC(––)ACC(––)92ACC(––)SectionCPM2A/CPM2C Pulse Output Functions2-52-5-1 Using Single-phase Pulse Outputs Without Acceleration andDeceleration (Fixed Duty Ratio)Select the pulse output number.Pulse output number 0 or 1Wire the outputs.Output numbers: 01000 and 01001PC Setup (DM 6629)PV coordinate system for pulse output numbers 0 and 1PULS(65): For setting the number of output pulses.Create a ladder diagram program.SPED(64): For pulse output control without acceleration and deceleration.INI(61): For stopping pulse outputs and changing the pulse output PV.PRV(62): For reading the pulse output PV and status.Single-phase Pulse OutputsPULS(65)SETPULSESinstructionSPED(64)Specify relative orabsolute pulses.Pulse output 0Pulse output 1Output mode: Continuous orIndependentTarget frequency: 10 Hz to 10 kHzPulse output SV(8 digits BCD)INI(61)SPEEDOUTPUTinstructionStart pulse outputs.MODECONTROLinstructionEvery scanPulse output statusStop pulse outputs.AR 11Change pulse output PV.AR 12Every scanPulse output PVSR 228SR 229SR 230SR 231ImmediatelyPRV(62)HIGH-SPEED COUNTERPV READ instructionRead pulse output PV.Read pulse outputstatus.PC SetupDM 6629,bits 04 to 07Selecting the PulseOutput NumberSelect either pulse number 0 or 1.Output numberPulse output number01000001001193SectionCPM2A/CPM2C Pulse Output FunctionsWiring the Outputs2-5Wire the CPM2A outputs as shown in the following illustration.