Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 38 of 60

SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual: SECTION 5 Instruction Set, pages 349 to 358

Pages 349 to 358 of 520, from SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual

The original document is the PDF (2.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Omron CQM1-CPU21

Page 349

Section 5-26

Special Instructions

In continuous mode, pulses will be output until the INI(61) instruction is executed with C=003 or SPED(64) is executed again with F=0000. If the direction (CW or CCW) is not specified when outputting from port 1 or 2, the pulses will be CW. Pulse Frequency (F)

The value of F sets the pulse frequency in units of 10 Hz, as shown below. Setting F to 0000 will stop the pulse output at the specified location. Output location

Possible values of F

Port 1 or 2

0000 (stops pulse output) or 0001 to 5000 (10 Hz to 50 kHz)

Output bits

0000 (stops pulse output) or 0002 to 0100 (20 Hz to 1 kHz)

Precaution Regarding Pulse Output The pulse frequency output from the CQM1-CPU43-EV1 is generated by dividing the 500-kHz basic clock by a dividing unit of an integer value, which results in a difference between the set frequency and actual frequency. Refer to the following equation for calculating an actual frequency. Set Frequency: Output frequency set in the instruction by the user Dividing Unit: An integer set in the dividing circuit to generate an output pulse of the set frequency Actual Frequency: Output pulse frequency actually output from the dividing circuit The dividing unit is set based on the frequency set by the user.

Pulsegenerating clock

Output pulse (actual frequency)

500 kHz Dividing circuit

Equation: Actual frequency (KHz) = 500 (KHz)/INT (500 (kHz)/Set frequency (kHz)) INT: Function for obtaining an integer value INT (500/Set frequency): Dividing unit The difference between the set frequency and actual frequency becomes larger as the frequency becomes higher. Example: Set frequency (kHz)

Actual frequency (kHz)

45.46 to 50.00

50.00

41.67 to 45.45

45.45

38.47 to 41.66

41.67

:

:

31.26 to 33.33

33.33

29.42 to 31.25

31.25

27.78 to 29.41

29.41

:

:

20.01 to 20.83

20.83

19.24 to 20.00

20.00

18.52 to 19.23

19.23

:

:

10.01 to 10.20

10.20

9.81 to 10.00

10.00

9.62 to 9.80

9.80

:

:

5.01 to 5.05

5.05

331

Page 350

Section 5-26

Special Instructions Set frequency (kHz)

Actual frequency (kHz)

4.96 to 5.00

5.00

4.90 to 4.95

4.95

:

:

3.02 to 3.03

3.03

3.00 to 3.01

3.01

2.98 to 2.99

2.99

:

:

Precautions

With the CQM1-CPU11/21-E, the output refreshing method in DM 6639 (PC Setup) must be set to direct output before initiating pulse output. The pulse output cannot be used when interval timer 0 is operating. When a pulse output with a frequency of 500 Hz or higher is output from an output bit, set interrupt processing for the TIMH(15) TC numbers 000 to 003 by setting #0104 in DM 6629 of the PC Setup. Only one output bit at a time can have a pulse output.

Flags

ER:

SPED(64) is executed while interval timer 0 is operating. Indirectly addressed DM word is non-existent. (Content of *DM word is not BCD, or the DM area boundary has been exceeded.) There is an error in the instruction settings. SPED(64) is executed in an interrupt subroutine while a pulse I/O or high-speed counter instruction is being executed in the main program.

5-26-11 PULSE OUTPUT – PLS2(––) Ladder Symbols

Operand Data Areas P: Communications port

PLS2(––)

@PLS2(––)

P

P

D

D

C

C

001 or 002 D: Direction specifier 000 or 001 C: First control word IR, SR, AR, DM, HR, LR

Limitations

This instruction is available in the CQM1-CPU43-E/-EV1 only. PLS2(––) cannot be used if the PC Setup (DM 6611) is set to high-speed counter mode. P must be 001 or 002 and D must be 000 or 001. C to C+3 must be in the same data area.

Description

PLS2(––) is used to output a specified number of CW or CCW pulses from port 1 or 2. The pulse output accelerates to the target frequency at a specified rate and decelerates at the same rate. (Pulse output stops at 100 Hz.)

Target frequency 100 Hz

T1

332

T2

T1

Page 351

Section 5-26

Special Instructions

The following equations show how to calculate the approximate acceleration/ deceleration time T1 and running time T2. Both times are in seconds. T 1 ^ 0.004 T2 ^ Note

Target frequency Accerationńdeceleration rate

Number of pulses * (T 1 Target frequency) Target frequency

1. Although T1 and T2 will vary slightly depending on the operating conditions, the number of pulses output will be accurate. 2. PLS2(––) will not operate if pulses are already being output from the specified port. Check the pulse output flags (AR 0515 for port 1 and AR 0615 for port 2) before executing PLS2(––). 3. Refer to 1-3 Pulse Output Functions for more details.

Operand Settings

P specifies the port where the pulses will be output. Pulses are output from port 1 when P=001, and pulses are output from port 2 when P=002. D specifies whether the output signal is clockwise (CW) or counter-clockwise (CCW). The output is CW when D=000 and CCW when D=001. The content of C determines the acceleration/deceleration rate. During acceleration or deceleration, the output frequency is increased or decreased by the amount set in C every 4.08 ms. C must be BCD from 0001 to 0200 (10 Hz to 2 kHz). The content of C+1 specifies the target frequency. C+1 must be BCD from 0010 to 5000 (100 Hz to 50 kHz). The 8-digit content of C+3,C+2 determines the number of pulses that will be output. C+3, C+2 must be BCD between 0000 0001 and 1677 7215.

Flags

ER:

There is an error in the operand settings. The CPU Unit is not a CQM1-CPU43-EV1. The PC Setup is not set for pulse output. The target frequency, acceleration/deceleration rate, and number of pulses are incorrect. (Number of pulses < T1 × Target frequency) PLS2(––) is executed in an interrupt subroutine while a pulse I/O or high-speed counter instruction is being executed in the main program. A data area boundary has been exceeded. Indirectly addressed DM word is non-existent. (Content of *DM word is not BCD, or the DM area boundary has been exceeded.)

AR 0515: AR 0615: ! Caution

Port 1 output flag. ON when pulses are being output from port 1. Port 2 output flag. ON when pulses are being output from port 2.

With PLS2(––), conditions such as acceleration/deceleration speed and the target speed can cause low-speed pulse output (100 Hz) to continue for an extended period of time when stopping. Even when this happens, the correct number of pulses will be output.

Time required for complete stop 100 Hz

333

Page 352

Section 5-26

Special Instructions

Correct the system by adjusting the acceleration/deceleration speed and/or the target speed, or by using the ACC(––) instruction (mode 0) to increase the speed (deceleration target frequency) when stopping.

5-26-12 ACCELERATION CONTROL – ACC(––) Ladder Symbols

Operand Data Areas P: Communications port

ACC(––)

@ACC(––)

P

P

M

M

C

C

001 or 002 M: Mode specifier 000 to 003 C: First control word IR, SR, AR, DM, HR, LR

Limitations

This instruction is available in the CQM1-CPU43-E/-EV1 only. Mode 0 of ACC(––) cannot be used if the PC Setup (DM 6611) is set to highspeed counter mode. P must be 001 or 002 and M must be 000 to 003. C to C+3 must be in the same data area.

Description

ACC(––) is used together with PULS(65) to control the acceleration and/or deceleration of pulses output from port 1 or 2. The 4 available modes are described briefly below. The function of the control words varies in the 4 modes, but P always specifies the port where the pulses will be output and M always specifies the mode. Set P=001 or 002 to indicate port 1 or 2. Set M=000 to 003 to indicate modes 0 to 3. Note Refer to 1-3 Pulse Output Functions for more details.

Mode 0 (M=000)

Mode 0 is used to output a specified number of CW or CCW pulses from port 1 or 2. The acceleration rate, frequency after acceleration, deceleration point, deceleration rate, and frequency after deceleration can all be controlled. Deceleration rate

Frequency after acceleration

Frequency after deceleration Acceleration rate

Deceleration point

Output stops.

PULS(65) Operand Settings

PULS(65) must be executed before ACC(––) in order to specify direction, the total number of pulses to be output, and the deceleration point. The function of PULS(65) operands are described below. Refer to 5-26-9 SET PULSES – PULS(65) for more details.

1, 2, 3...

1. The first operand of PULS(65) specifies the output port. Pulses are output from port 1 when P=001, and from port 2 when P=002. 2. The second operand specifies the direction. The output is clockwise (CW) when C=002 and counter-clockwise (CCW) when C=003. 3. The third operand specifies the first of 4 control words. a) The 8-digit content of N+1,N (0000 0001 to 1677 7215) determines the total number of pulses that will be output.

334

Page 353

Section 5-26

Special Instructions b) The 8-digit content of N+3,N+2 (0000 0001 to 1677 7215) determines the deceleration point. ACC(––) Control Words 1, 2, 3...

The 4 control words indicate the acceleration rate, frequency after acceleration, deceleration rate, and frequency after deceleration. 1. The content of C determines the acceleration rate. During acceleration, the output frequency is increased by the amount set in C every 4.08 ms. C must be BCD from 0001 to 0200 (10 Hz to 2 kHz). 2. The content of C+1 specifies the frequency after acceleration. C+1 must be BCD from 0000 to 5000 (0 Hz to 50 kHz). 3. The content of C+2 determines the deceleration rate. During deceleration, the output frequency is decreased by the amount set in C+2 every 4.08 ms. C must be BCD from 0001 to 0200 (10 Hz to 2 kHz). 4. The content of C+3 specifies the frequency after deceleration. C+3 must be BCD from 0000 to 5000 (0 Hz to 50 kHz).

Mode 1 (M=001)

Mode 1 is used to increase the frequency being output to a target frequency at the specified rate. Pulse output continues until stopped.

Target frequency

Frequency before acceleration

Acceleration rate

Execution of ACC(––)

The 2 control words indicate the acceleration rate and target frequency. 1, 2, 3...

1. The content of C determines the acceleration rate. During acceleration, the output frequency is increased by the amount set in C every 4.08 ms. C must be BCD from 0001 to 0200 (10 Hz to 2 kHz). 2. The content of C+1 specifies the target frequency. C+1 must be BCD from 0000 to 5000 (0 Hz to 50 kHz).

Mode 2 (M=002)

Mode 2 is used to decrease the frequency being output to a target frequency at the specified rate. Output stops when the total number of pulses specified in PULS(65) have been output.

Frequency before deceleration Deceleration rate Target frequency

Execution of ACC(––)

Output stops.

The 2 control words indicate the deceleration rate and target frequency. 1, 2, 3...

1. The content of C determines the deceleration rate. During deceleration, the output frequency is decreased by the amount set in C every 4.08 ms. C must be BCD from 0001 to 0200 (10 Hz to 2 kHz). 2. The content of C+1 specifies the target frequency. C+1 must be BCD from 0000 to 5000 (0 Hz to 50 kHz).

335

Page 354

Section 5-26

Special Instructions Mode 3 (M=003)

Mode 3 is used to decrease the frequency being output to a target frequency at the specified rate. Pulse output continues until stopped. Frequency before deceleration Deceleration rate Target frequency

Execution of ACC(––)

The 2 control words indicate the acceleration rate and target frequency. 1, 2, 3...

Flags

1. The content of C determines the acceleration rate. During acceleration, the output frequency is increased by the amount set in C every 4.08 ms. C must be BCD from 0001 to 0200 (10 Hz to 2 kHz). 2. The content of C+1 specifies the target frequency. C+1 must be BCD from 0000 to 5000 (0 Hz to 50 kHz). ER:

There is an error in the operand settings. The CPU Unit is not a CQM1-CPU43-EV1. The PC Setup is not set for pulse output. ACC(––) is executed with M=000 and the specified output port is in use. ACC(––) is executed in an interrupt subroutine while a pulse I/O or highspeed counter instruction is being executed in the main program. Indirectly addressed DM word is non-existent. (Content of *DM word is not BCD, or the DM area boundary has been exceeded.)

AR 0515:

Port 1 output flag. ON when pulses are being output from port 1.

AR 0615:

Port 2 output flag. ON when pulses are being output from port 2.

5-26-13 PULSE WITH VARIABLE DUTY RATIO – PWM(––) Ladder Symbols

Operand Data Areas P: Communications port

PWM(––)

@PWM(––)

P

P

F

F

D

D

001 or 002 F: Frequency 000, 001, or 002 D: Duty ratio IR, SR, AR, DM, HR, TC, LR, #

Limitations

This instruction is available in the CQM1-CPU43-E/-EV1 only. PWM(––) cannot be used unless the PC Setup (DM 6643 or DM 6644) is set for variable duty ratio pulse outputs. P must be 001 or 002 and F must be 000, 001, or 002. D must be BCD between 0001 and 0099.

Description

PWM(––) is used to output pulses with the specified duty ratio from port 1 or 2. The output can be set to one of three frequencies: 5.9 kHz, 1.5 kHz, or 91.6 Hz. The pulse output continues until INI(61) is executed to stop it.

336

Page 355

Section 5-26

Special Instructions

In order for PWM(––) to be executed, the specified port must be set for variable duty ratio pulse outputs in the PC Setup. Set the leftmost digit of DM 6643 to 1 to enable variable duty ratio pulse output from port 1, and set the leftmost digit of DM 6644 to 1 to enable variable duty ratio pulse output from port 2. It is not possible to output normal pulses from a port that is set for variable duty ratio output. Note Refer to 1-3 Pulse Output Functions for more details. Operand Settings

P specifies the port where the pulses will be output. Pulses are output from port 1 when P=001, and pulses are output from port 2 when P=002. F specifies the frequency of the pulse output, as shown in the following table. F

Frequency

000

5.9 kHz

001

1.5 kHz

002

91.6 Hz

D specifies the duty ratio of the pulse output, i.e., the percentage of time that the output is ON. D must be BCD from 0001 to 0099 (1% to 99%). The duty ratio is 75% in the following diagram. ton t on + D (1% to 99%) T T

Flags

ER:

There is an error in the operand settings. The CPU Unit is not a CQM1-CPU43-EV1. The PC Setup is not set for variable duty ratio pulse output. PWM(––) is executed in an interrupt subroutine while a pulse I/O or high-speed counter instruction is being executed in the main program. Indirectly addressed DM word is non-existent. (Content of *DM word is not BCD, or the DM area boundary has been exceeded.)

5-26-14 DATA SEARCH – SRCH(––) Ladder Symbols

Operand Data Areas N: Number of words

SRCH(––)

@SRCH(––)

N

N

R1

R1

C

C

IR, SR, AR, DM, HR, TC, LR, # R1: First word in range IR, SR, AR, DM, HR, TC, LR C: Comparison data, result word IR, SR, AR, DM, HR, LR

Limitations

This instruction is available in the CQM1 only. N must be BCD between 0001 to 9999. R1 and R1+N–1 must be in the same data area. DM 6143 to DM 6655 cannot be used for C.

Description

When the execution condition is OFF, SRCH(––) is not executed. When the execution condition is ON, SRCH(––) searches the range of memory from R1 to R1+N–1 for addresses that contain the comparison data in C. If one or more addresses contain the comparison data, the EQ Flag (SR 25506) is turned ON and the lowest address containing the comparison data is identified in C+1. The address is identified differently for the DM area:

337

Page 356

Section 5-26

Special Instructions 1, 2, 3...

Flags

1. For an address in the DM area, the word address is written to C+1. For example, if the lowest address containing the comparison data is DM 0114, then #0114 is written in C+1. 2. For an address in another data area, the number of addresses from the beginning of the search is written to C+1. For example, if the lowest address containing the comparison data is IR 114 and the first word in the search range is IR 014, then #0100 is written in C+1. If none of addresses in the range contain the comparison data, the EQ Flag (SR 25506) is turned OFF and C+1 is left unchanged. ER:

Indirectly addressed DM word is non-existent. (Content of DM word is not BCD, or the DM area boundary has been exceeded.) N is not BCD between 0001 and 9999.

EQ: Example

ON when the comparison data has been matched in the search range.

In the following example, the 10 word range from DM 0010 to DM 0019 is searched for addresses that contain the same data as DM 0000 (#FFFF). Since DM 0012 contains the same data, the EQ Flag (SR 25506) is turned ON and #0012 is written to DM 0001. 00001 @SRCH(––) #0010 DM 0010

Instruction

00000 00001

LD @SRCH(––)

Operands 00001 # DM DM

DM 0000

DM 0010 DM 0011 DM 0012 DM 0013 DM 0014 DM 0015 DM 0016 DM 0017 DM 0018 DM 0019

Address

0000 9898 FFFF 9797 AAAA 9595 1414 0000 0000 FFFF

DM 0000 DM 0001

0010 0010 0000

FFFF 0012

5-26-15 PID CONTROL – PID(––) Ladder Symbol

Operand Data Areas IW: Input data word

PID(––) IR, SR, AR, DM, HR, LR IW P1: First parameter word P1 OW

IR, SR, DM, HR, LR OW: Output data word IR, SR, AR, DM, HR, LR

Limitations

338

This instruction is available in the only. DM 6144 to DM 6655 cannot be used for IW, P1 to P1+32, or OW. P1 to P1+32 must be in the same data area.

Page 357

Section 5-26

Special Instructions ! Caution

Description

Word

A total of 33 continuous words starting with P1 must be provided for PID(––) to operate correctly. Also, PID(––) may not operate dependably in any of the following situations: In interrupt programs, in subroutines, between IL(02) and ILC(03), between JMP(04) and JME(05), and in step programming (STEP(08)/SNXT(09)). Do not program PID(––) in these situations. PID(––) performs PID control based on the parameters specified in P1 through P1+6. The data in IW is used to calculate the output data that is written to OW. The following table shows the function of the parameter words.

Bits

Parameter name

P1

00 to 15

Set value (SV).

P1+1

00 to 15

Proportional band width.

P1+2

00 to 15

Integral time

P1+3

00 to 15

Derivative time

P1+4

00 to 15

Sampling period

P1+5

00 to 03

Operation specifier

04 to 15

Input filter coefficient

Function/Setting range This is the target value for PID control. It can be set to any binary number with the number of bits set by the input range parameter. This parameter specifies the proportional band width/input range ratio from 0.1% to 999.9%. It must be BCD from 0001 to 9999. Sets the integral time/sampling period ratio used in integral control. It must be BCD from 0001 to 8191, or 9999. (9999 disables integral control.) Sets the derivative time/sampling period ratio used in derivative control. It must be BCD from 0001 to 8191, or 0000. Sets the interval between samplings of the input data from 0.1 to 102.3 s. It must be BCD from 0001 to 1023. Sets reverse or normal operation. Set to 0 to specify reverse operation or 1 to specify normal operation. Determines the strength of the input filter. The lower the coefficient, the weaker the filter. This setting must be BCD from 100 to 199, or 000. A setting of 000 sets the default value (0.65) and a setting of 100 to 199 sets the coefficient from 0.00 to 0.99.

P1+6

P1+7 to P1+32

00 to 07

Output range

Determines the number of bits of output data. This setting must be between 00 and 08, which sets the output range between 8 and 16 bits.

08 to 15

Input range

00 to 15

Work area

Determines the number of bits of input data. This setting must be between 00 and 08, which sets the input range between 8 and 16 bits. Do not use. (Used by the system.)

When the execution condition is OFF, PID(––) is not executed and the instruction’s data is maintained. While the execution condition is OFF, the desired output data can be written directly to OW for manual control. When the execution condition first goes from OFF to ON, PID(––) reads the parameters and initializes the work area. There is a built-in function to change the output data continuously at startup because sudden changes in the output data might adversely affect the controlled system. ! Caution

Changes made to the parameters will not be effective until the execution condition for PID(––) goes from OFF to ON.

Note Do not use PID(––) in the following situations; it may not be executed properly. In interrupt programs In subroutine programs In interlocked program sections (between IL and ILC) In jump program sections (between JMP and JME) In step ladder program section (created with STEP) When the execution condition is ON, PID(––) performs the PID calculation on the input data when the sampling period has elapsed. The sampling period is the time that must pass before input data is read for processing.

339

Page 358

Section 5-27

Communications Instructions

The following diagram shows the relationship between the sampling period and PID processing. PID processing is performed only when the sampling period (100 ms in this case) has elapsed. 1 cycle

60 ms

70 ms

70 ms

70 ms

PID processing No processing (70+30=100 ms, (70 ms) no carryover) PID processing PID processing No processing with initial values (130 ms, 30 ms carryover) (60 ms) (0 ms)

Flags

ER:

There is an error in the parameter settings. The cycle time is more than twice as long as the sampling period, so PID(–) cannot be executed accurately. PID(––) will be executed in this case. Indirectly addressed DM word is non-existent. (Content of *DM word is not BCD, or the DM area boundary has been exceeded.)

CY:

ON when PID processing has been performed. (OFF when the sampling period has not elapsed.)

5-27 Communications Instructions 5-27-1 RECEIVE – RXD(47) Operand Data Areas

Ladder Symbols

D: First destination word RXD(47)

@RXD(47)

D

D

C

C

N

N

IR, SR, AR, DM, HR, TC, LR C: Control word # N: Number of bytes IR, SR, AR, DM, HR, TC, LR, #

Limitations

This instruction is available in the CQM1/SRM1 only. D and D+(N÷2)–1 must be in the same data area. DM 6144 to DM 6655 cannot be used for D or N. N must be BCD from #0000 to #0256. (#0000 to #0061 in host link mode)

Description

When the execution condition is OFF, RXD(47) is not executed. When the execution condition is ON, RXD(47) reads N bytes of data received at the port specified in the control word, and then writes that data in words D to D+(N÷2)–1. Up to 256 bytes of data can be read at one time. If fewer than N bytes are received, the amount received will be read. Note Refer to 1-9 Communications Functions for details on using the RXD(47) instruction, setting communications protocol in the PC Setup, etc. ! Caution

340

The CQM1 or SRM1 will be incapable of receiving more data once 256 bytes have been received if received data is not read using RXD(47). Read data as soon as possible after the Reception Completed Flag is turned ON (AR 0806 for the RS-232C port, AR 0814 for the peripheral port.)