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

The text of a manual · part 51 of 60

SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual: Appendix A Programming Instructions

Pages 458 to 463 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 458

Appendix A Programming Instructions A PC instruction is input either by pressing the corresponding Programming Console key(s) (e.g., LD, AND, OR, NOT) or by using function codes. To input an instruction with its function code, press FUN, the function code, and then WRITE. Refer to the pages listed programming and instruction details. Code

Mnemonic

Name

Function

Page

Logically ANDs status of designated bit with execution condition. Logically ANDs results of preceding blocks.

196

Logically ANDs inverse of designated bit with execution condition. A decrementing counter.

196

Used to start instruction line with the status of the designated bit or to define a logic block for use with AND LD and OR LD. Used to start instruction line with inverse of designated bit.

196

Logically ORs status of designated bit with execution condition. Logically ORs results of preceding blocks.

196

Logically ORs inverse of designated bit with execution condition. Turns ON operand bit for ON execution condition; turns OFF operand bit for OFF execution condition. Turns operand bit OFF for ON execution condition; turns operand bit ON for OFF execution condition (i.e., inverts operation).

196

RESET

Turns the operand bit OFF when the execution condition is ON, and does not affect the status of the operand bit when the execution condition is OFF.

198

SET

SET

Turns the operand bit ON when the execution condition is ON, and does not affect the status of the operand bit when the execution condition is OFF.

198, TIM

TIMER

ON-delay (decrementing) timer operation.

209

00

NOP

NO OPERATION

Nothing is executed and program moves to next instruction.

201

01

END

END

201

02

IL

INTERLOCK

03

ILC

INTERLOCK CLEAR

04 05 06

JMP JME (@)FAL

07

FALS

08

STEP

JUMP JUMP END FAILURE ALARM AND RESET SEVERE FAILURE ALARM STEP DEFINE

Required at the end of the program. If interlock condition is OFF, all outputs are turned OFF and all timer PVs reset between this IL(02) and the next ILC(03). Other instructions are treated as NOP; counter PVs are maintained. If jump condition is OFF, all instructions between JMP(04) and the corresponding JME(05) are ignored.

09

SNXT

STEP START

10

SFT

11

KEEP

12

13, AND

AND, AND LD

AND LOAD, AND NOT

AND NOT, CNT

COUNTER, LD

LOAD, LD NOT

LOAD NOT, OR

OR, OR LD

OR LOAD, OR NOT

OR NOT, OUT

OUTPUT, OUT NOT

OUTPUT NOT, RSET, Generates a non-fatal error and outputs the designated FAL number to the Programming Console. Generates a fatal error and outputs the designated FALS number to the Programming Console. When used with a control bit, defines the start of a new step and resets the previous step. When used without N, defines the end of step execution.

197

210

196

197

197 197

201 201 203 203 205 205 206

206

SHIFT REGISTER

Used with a control bit to indicate the end of the step, reset the step, and start the next step. Creates a bit shift register.

KEEP

Defines a bit as a latch controlled by set and reset inputs.

199

CNTR

REVERSIBLE COUNTER

Increases or decreases PV by one whenever the increment input or decrement input signals, respectively, go from OFF to ON.

211

DIFU

DIFFERENTIATE UP

Turns ON the designated bit for one cycle on the rising edge of the input signal.

200

224

441

Page 459

Appendix A

Programming Instructions Code

Mnemonic

14

DIFD

15

Name

Function

Page

Turns ON the bit for one cycle on the trailing edge.

200

TIMH

DIFFERENTIATE DOWN HIGH-SPEED TIMER

A high-speed, ON-delay (decrementing) timer.

212

16

(@)WSFT

WORD SHIFT

Shifts data between starting and ending words in word units, writing zeros into starting word.

225

17 to 19

For expansion instructions.

20

CMP

COMPARE

21

(@)MOV

MOVE

22

(@)MVN

MOVE NOT

23

(@)BIN

BCD TO BINARY

24

(@)BCD

BINARY TO BCD

25

(@)ASL

26

(@)ASR

27

(@)ROL

ARITHMETIC SHIFT LEFT ARITHMETIC SHIFT RIGHT ROTATE LEFT

28

(@)ROR

ROTATE RIGHT

29

(@)COM

30

(@)ADD

31

(@)SUB

BCD SUBTRACT

32

(@)MUL

BCD MULTIPLY

33

(@)DIV

BCD DIVIDE

34

(@)ANDW

LOGICAL AND

35

(@)ORW

36

116 Compares the contents of two words and outputs result to GR, EQ, and LE Flags. Copies source data (word or constant) to destination word.

242

Inverts source data (word or constant) and then copies it to destination word. Converts four-digit, BCD data in source word into 16-bit binary data, and outputs converted data to result word. Converts binary data in source word into BCD, and outputs converted data to result word. Shifts each bit in single word of data one bit to left, with CY.

232

Shifts each bit in single word of data one bit to right, with CY.

226

Rotates bits in single word of data one bit to left, with CY.

226

Rotates bits in single word of data one bit to right, with CY.

227

COMPLEMENT

Inverts bit status of one word of data.

308

BCD ADD

Adds two four-digit BCD values and content of CY, and outputs result to specified result word. Subtracts a four-digit BCD value and CY from another fourdigit BCD value and outputs result to the result word. Multiplies two four-digit BCD values and outputs result to specified result words. Divides four-digit BCD dividend by four-digit BCD divisor and outputs result to specified result words. Logically ANDs two 16-bit input words and sets corresponding bit in result word if corresponding bits in input words are both ON.

278

LOGICAL OR

Logically ORs two 16-bit input words and sets corresponding bit in result word if one or both of corresponding bits in input data are ON.

309

(@)XORW

EXCLUSIVE OR

310

37

(@)XNRW

EXCLUSIVE NOR

Exclusively ORs two 16-bit input words and sets bit in result word when corresponding bits in input words differ in status. Exclusively NORs two 16-bit input words and sets bit in result word when corresponding bits in input words are same in status.

38

(@)INC

BCD INCREMENT

Increments four-digit BCD word by one.

311

39

(@)DEC

BCD DECREMENT

Decrements four-digit BCD word by one.

312

40

(@)STC

SET CARRY

Sets carry flag (i.e., turns CY ON).

278

41

(@)CLC

CLEAR CARRY

Clears carry flag (i.e, turns CY OFF).

278

45

TRSM

TRACE MEMORY SAMPLE

Initiates data tracing. Cannot be used with CQM1-CPU11/21-E/CPM1/CPM1A /SRM1.

315

46

(@)MSG

MESSAGE

Displays a 16-character message on the Programming Console display.

317

47 & 48

For expansion instructions.

50

(@)ADB

BINARY ADD

51

(@)SBB

BINARY SUBTRACT

52

(@)MLB

BINARY MULTIPLY

442

232

252 253 225

279 281 282 309

311

116 Adds two four-digit hexadecimal values and content of CY, and outputs result to specified result word. Subtracts a four-digit hexadecimal value and CY from another four-digit hexadecimal value and outputs result to the result word.

289

Multiplies two four-digit hexadecimal values and outputs result to specified result words.

291

290

Page 460

Appendix A

Programming Instructions Code

Mnemonic

Name

Function

Page 292

53

(@)DVB

BINARY DIVIDE

Divides four-digit hexadecimal dividend by four-digit hexadecimal divisor and outputs result to specified result words.

54

(@)ADDL

DOUBLE BCD ADD

Adds two eight-digit values (2 words each) and content of CY, 284 and outputs result to specified result words.

55

(@)SUBL

DOUBLE BCD SUBTRACT

Subtracts an eight-digit BCD value and CY from another eight-digit BCD value and outputs result to the result words.

285

56

(@)MULL

DOUBLE BCD MULTIPLY

Multiplies two eight-digit BCD values and outputs result to specified result words.

286

57

(@)DIVL

DOUBLE BCD DIVIDE

Divides eight-digit BCD dividend by eight-digit BCD divisor and outputs result to specified result words.

287

58

(@)BINL

DOUBLE BCD TO DOUBLE BINARY

Converts BCD value in two consecutive source words into binary and outputs converted data to two consecutive result words. (CQM1 only)

254

59

(@)BCDL

DOUBLE BINARY TO DOUBLE BCD

Converts binary value in two consecutive source words into BCD and outputs converted data to two consecutive result words. (CQM1 only)

254

60 to 69

For expansion instructions.

70

(@)XFER

BLOCK TRANSFER

Moves content of several consecutive source words to consecutive destination words.

233

71

(@)BSET

BLOCK SET

Copies content of one word or constant to several consecutive words.

234

72

(@)ROOT

SQUARE ROOT

Computes square root of eight-digit BCD value and outputs truncated four-digit integer result to specified result word. (CQM1 only)

288

73

(@)XCHG

DATA EXCHANGE

Exchanges contents of two different words.

235

74

(@)SLD

ONE DIGIT SHIFT LEFT

Left shifts data between starting and ending words by one digit (four bits).

228

75

(@)SRD

ONE DIGIT SHIFT RIGHT

Right shifts data between starting and ending words by one digit (four bits).

228

76

(@)MLPX

4-TO-16 DECODER

Converts up to four hexadecimal digits in source word into decimal values from 0 to 15 and turns ON, in result word(s), bit(s) whose position corresponds to converted value.

255

77

(@)DMPX

16-TO-4 ENCODER

Determines position of highest ON bit in source word(s) and turns ON corresponding bit(s) in result word.

257

78

(@)SDEC

7-SEGMENT DECODER

Converts hexadecimal values from source word to data for seven-segment display.

259

80

(@)DIST

SINGLE WORD DISTRIBUTE

Moves one word of source data to destination word whose address is given by destination base word plus offset.

235

81

(@)COLL

DATA COLLECT

Extracts data from source word and writes it to destination word.

237

82

(@)MOVB

MOVE BIT

Transfers designated bit of source word or constant to designated bit of destination word.

239

83

(@)MOVD

MOVE DIGIT

Moves hexadecimal content of specified four-bit source digit(s) to specified destination digit(s) for up to four digits.

240

84

(@)SFTR

REVERSIBLE SHIFT REGISTER

Shifts data in specified word or series of words to either left or right.

229

85

(@)TCMP

TABLE COMPARE

Compares four-digit hexadecimal value with values in table consisting of 16 words.

243

86

(@)ASC

ASCII CONVERT

Converts hexadecimal values from the source word to eightbit ASCII code starting at leftmost or rightmost half of starting destination word.

262

87 to 89

For expansion instructions.

91

(@)SBS

SUBROUTINE ENTRY

Calls and executes subroutine N.

313

92

SBN

SUBROUTINE DEFINE

Marks start of subroutine N.

315

93

RET

RETURN

Marks the end of a subroutine and returns control to main program.

315

116

116

443

Page 461

Appendix A

Programming Instructions Code

Mnemonic

Name

97

(@)IORF

I/O REFRESH

99

(@)MCRO

MACRO

Function

Page

Refreshes all I/O words between the start and end words. Cannot be used with the SRM1. Calls and executes a subroutine replacing I/O words.

318 319

Expansion Instructions The following table shows the instructions that can be treated as expansion instructions. The default function codes are given for instructions that have codes assigned by default. Code Mnemonic

Name

Function

CPU Units All

Page 230

CQM1

347

CQM1

247

CQM1/ SRM1 CQM1/ SRM1 All

340

17

(@)ASFT

ASYNCHRONOUS SHIFT REGISTER

Creates a shift register that exchanges the contents of adjacent words when one of the words is zero and the other is not.

18

TKY

TEN KEY INPUT

19

(@)MCMP

MULTI-WORD COMPARE

47

(@)RXD

RECEIVE

Inputs 8 digits of BCD data from a 10-key keypad. Compares a block of 16 consecutive words to another block of 16 consecutive words. Receives data via a communications port.

48

(@)TXD

TRANSMIT

Sends data via a communications port.

60

CMPL

DOUBLE COMPARE

Compares two eight-digit hexadecimal values.

61

(@)INI

MODE CONTROL

Starts and stops counter operation, compares and changes counter PVs, and stops pulse output.

All except SRM1

220

62

(@)PRV (@)CTBL

64

(@)SPED

Reads counter PVs and status data for the highspeed counter. Compares counter PVs and generates a direct table or starts operation. Outputs pulses at the specified frequency (10 Hz to 50 KHz in 10 Hz units). The output frequency can be changed while pulses are being output.

All except SRM1 All except SRM1 CQM1

221

63

HIGH-SPEED COUNTER PV READ COMPARISON TABLE LOAD SPEED OUTPUT

65

(@)PULS

SET PULSES

CQM1

328

66

(@)SCL

SCALE

CQM1

266

67

(@)BCNT

BIT COUNTER

All

320

68

(@)BCMP

BLOCK COMPARE

All

244

69

(@)STIM

INTERVAL TIMER

All

213

87

DSW

DIGITAL SWITCH INPUT

CQM1

346

88

7SEG

CQM1

345

89

(@)INT

7-SEGMENT DISPLAY OUTPUT INTERRUPT CONTROL

(@)ACC

ACCELERATION CONTROL

All except SRM1 CQM1CPU43-E V1

326

---

Outputs the specified number of pulses at the specified frequency. The pulse output cannot be stopped until the specified number of pulses have been output. Performs a scaling conversion on the calculated value. Counts the total number of bits that are ON in the specified block of words. Judges whether the value of a word is within 16 ranges (defined by lower and upper limits). Controls interval timers used to perform scheduled interrupts. Inputs 4- or 8-digit BCD data from a digital switch. Converts 4- or 8-digit data to 7-segment display format and then outputs the converted data. Performs interrupt control, such as masking and unmasking the interrupt bits for I/O interrupts. Together with PULS(––), ACC(––) controls the acceleration and/or deceleration of pulses output from port 1 or 2.

---

(@)ADBL

DOUBLE BINARY ADD

CQM1

293

---

(@)APR

ARITHMETIC PROCESS

Adds two 8-digit binary values (normal or signed data) and outputs the result to R and R+1. Performs sine, cosine, or linear approximation calculations.

CQM1

305

444

342 246

215 330

334

Page 462

Appendix A

Programming Instructions Code Mnemonic

Name

Function

CPU Units CQM1

Page 302

---

AVG

AVERAGE VALUE

Adds the specified number of hexadecimal words and computes the mean value. Rounds off to 4 digits past the decimal point.

---

(@)COLM

LINE TO COLUMN

Copies the 16 bits from the specified word to a bit column of 16 consecutive words.

CQM1

274

---

CPS

SIGNED BINARY COMPARE

Compares two 16-bit (4-digit) signed binary values and outputs the result to the GR, EQ, and LE flags.

CQM1

248

---

CPSL

DOUBLE SIGNED BINARY COMPARE

Compares two 32-bit (8-digit) signed binary values and outputs the result to the GR, EQ, and LE flags.

CQM1

249

---

(@)DBS

SIGNED BINARY DIVIDE

Divides one 16-bit signed binary value by another and outputs the 32-bit signed binary result to R+1 and R.

CQM1

298

---

(@)DBSL

DOUBLE SIGNED BINARY DIVIDE

Divides one 32-bit signed binary value by another and outputs the 64-bit signed binary result to R+3 to R.

CQM1

299

---

(@)FCS

FCS CALCULATE

Checks for errors in data transmitted by a Host Link command.

CQM1/ SRM1

321

---

FPD

FAILURE POINT DETECT

Finds errors within an instruction block.

CQM1

322

---

(@)HEX

ASCII-TO-HEXADECIMAL Converts ASCII data to hexadecimal data.

CQM1/ SRM1

263

---

HKY

HEXADECIMAL KEY INPUT

Inputs up to 8 digits of hexadecimal data from a 16-key keypad.

CQM1

347

---

(@)HMS

SECONDS TO HOURS

Converts second data to hour and minute data.

CQM1

272

---

(@)LINE

LINE

Copies a bit column from 16 consecutive words to the specified word.

CQM1

273

---

(@)MAX

FIND MAXIMUM

Finds the maximum value in specified data area and outputs that value to another word.

CQM1

300

---

(@)MBS

SIGNED BINARY MULTIPLY

Multiplies the signed binary content of two words and outputs the 8-digit signed binary result to R+1 and R.

CQM1

296

---

(@)MBSL

DOUBLE SIGNED BINARY MULTIPLY

Multiplies two 32-bit (8-digit) signed binary values and outputs the 16-digit signed binary result to R+3 through R.

CQM1

297

---

(@)MIN

FIND MINIMUM

Finds the minimum value in specified data area and outputs that value to another word.

CQM1

301

---

(@)NEG

2’S COMPLEMENT

Converts the four-digit hexadecimal content of the source word to its 2’s complement and outputs the result to R.

CQM1

275

---

(@)NEGL

DOUBLE 2’S COMPLEMENT

Converts the eight-digit hexadecimal content of the source words to its 2’s complement and outputs the result to R and R+1.

CQM1

276

---

PID

PID CONTROL

Performs PID control based on the specified parameters.

CQM1CPU43-E V1

338

---

(@)PLS2

PULSE OUTPUT

Accelerates pulse output from 0 to the target frequency at a specified rate and decelerates at the same rate.

332

---

(@)PWM

PULSE WITH VARIABLE DUTY RATIO

Outputs pulses with the specified duty ratio (0% to 99%) from port 1 or 2.

CQM1CPU43-E V1

336

---

(@)SBBL

DOUBLE BINARY SUBTRACT

Subtracts an 8-digit binary value (normal or signed data) from another and outputs the result to R and R+1.

CQM1

294

445

Page 463

Appendix A

Programming Instructions Code Mnemonic

Name

Function

CPU Units CQM1

Page

---

(@)SCL2

SIGNED BINARY TO BCD Linearly converts a 4-digit signed hexadecimal SCALING value to a 4-digit BCD value.

---

(@)SCL3

BCD TO SIGNED BINARY Linearly converts a 4-digit BCD value to a 4-digit SCALING signed hexadecimal value.

CQM1

269

---

(@)SEC

HOURS TO SECONDS

Converts hour and minute data to second data.

CQM1

271

---

(@)SRCH

DATA SEARCH

Searches the specified range of memory for the specified data. Outputs the word address(es) of words in the range that contain the data.

CQM1

337

---

(@)STUP

344

(@)SUM

CQM1

303

---

(@)XFRB

CQM1

241

---

ZCP

Changes the communications parameters in the PC Setup for a specified port. Computes the sum of the contents of the words in the specified range of memory. TRANSFER BITS Copies the status of up to 255 specified source bits to the specified destination bits. AREA RANGE COMPARE Compares a word to a range defined by lower and upper limits and outputs the result to the GR, EQ, and LE flags.

SRM1

---

CHANGE RS-232C SETUP SUM CALCULATE

CQM1

250

---

ZCPL

DOUBLE AREA RANGE COMPARE

CQM1

252

446

Compares an 8-digit value to a range defined by lower and upper limits and outputs the result to the GR, EQ, and LE flags.

268