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

The text of a manual · part 17 of 60

SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual: SECTION 2 Special Features, pages 144 to 152

Pages 144 to 152 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 144

Section

Advanced I/O Instructions (CQM1 Only)

2-2

If the input word for connecting the digital switch is specified at for IW, and the output word is specified for OW, then operation will proceed as shown below when the program is executed. IW Four digits: 00 to 03 100

101

102

103

Eight digits: 00 to 03, 04 to 07

Input data Leftmost 4 digits

Wd 0

D+1

Rightmost 4 digits D

00 When only 4 digits are read, only word D is used.

01

CS signal

02 03 04

RD (read) signal

05

1 Round Flag 0

1

2

3

4

5

6

7

8

9

10 11 12 13 14 15 16

16 cycles to complete one round of execution

SR 25410 will turn ON while DSW(87) is being executed. Note

1. Do not use DSW(87) more than once within the same program. 2. When using DSW(87), set the input constant for the relevant input word to less than the cycle time. (Input constants can be changed from DM 6620 onwards.) The characteristics of the digital switch must also be considered in system and program design. 3. Input and output bits not used here can be used as ordinary input and output bits. With this instruction, 4-digit or 8-digit set values can be read in 16 cycles.

Application Example

This example shows a program for reading 4 digits in BCD from the digital switch. Assume that the digital switch is connected to IR 000 (input) and IR 100 (output), and assume the default status for all the PC Setup (4 digits to read). The data set from the digital switch by DSW(87) is stored in HR 51. When IR 00015 turns ON, the value stored in HR 51 is moved to DM 0001. 25313 DSW(87) 000 100 HR51 00015 @MOV(21) HR51 DM0000

Note Output point 5 (here, IR 10005) turns on when one round of data is read and can be used to time switching the data storage area and gate signal (CS signal) when DSW(87) is used to input data to different areas of memory.

124

Page 145

Section

Advanced I/O Instructions (CQM1 Only)

2-2

2-2-4 7-SEGMENT DISPLAY OUTPUT – 7SEG(88) This instruction outputs word data to a 7-segment display. It utilizes either 8 (for 4 digits) or 12 (for 8 digits) output bits. Hardware

The 7-segment display is connected to an Output Unit as shown in the diagram below. For 4-digit display, the data outputs (D0 to D3) are connected to output points 0 through 3, and latch outputs (CS0 to CS3) are connected to output points 4 through 7. Output point 12 (for 8-digit display) or output point 8 (for 4-digit display) will be turned ON when one round of data is displayed, but there is no need to connect them unless required by the application. D0 D1 D2 D3 LE3

LE2

VDD (+) VSS (0) LE1 LE0

VDD (+) VSS (0) LE3

LE2

LE1

D0 D1 D2 D3 LE0 OD212 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 DC COM

The outputs can be connected from a Transistor Output Unit with 8 or more output points for four digits or 16 or more output points for eight digits. Note

1. Output Unit outputs normally employ negative logic. (Only the PNP output type employs positive logic.) 2. The 7-segment display may require either positive or negative logic, depending on the model.

Using the Instruction 7SEG(88) S O

S: First source word O: Output word C: Control data

C

If the first word holding the data to be displayed is specified at S, and the output word is specified at O, and the SV taken from the table below is specified at C, then operation will proceed as shown below when the program is executed. Data Storage Format Leftmost 4 digits

Rightmost 4 digits

S+1

S

If only four digits are displayed, then only word S will be used.

125

Page 146

Section

Advanced I/O Instructions (CQM1 Only)

2-2

Set Values for Selecting Logic and Number of Digits (C) Number of digits displayed 4 digits (4 digits, 1 block)

Display Unit data input and Output Unit logic Same

Display Unit latch input and Output Unit logic Same Different Same Different Same Different Same Different

Different 8 digits (4 digits, 2 blocks)

Same Different

C setting data 000 001 002 003 004 005 006 007

Note Do not set C to values other than 000 to 007. Bit(s) in O

Function

Output status (Data and latch logic depends on C)

(4 digits, 1 block)

(4 digits, 2 blocks)

00 to 03

00 to 03 04 to 07

Latch output 0

04

08

Latch output 1

05

09

Latch output 2

06

10

Latch output 3

07

11

One Round Flag

08

12

Data output

100

1

2

3

101

4

5

6

102

7

8

9

103

Note 0 to 3: Data output for word S 4 to 7: Data output for word S+1

10 11 12 1

12 cycles required to complete one round

SR 25409 will turn ON while 7SEG(88) is being executed. Note

1. Do not use 7SEG(88) more than once within the same program. 2. Consider the cycle time and the characteristics of the 7-segment display when designing the system. 3. Output bits not used here can be used as ordinary output bits. With this instruction, 4 digits or 8 digits are displayed in 12 cycles. Operation will proceed from the first execution without regard to the status prior to execution.

Application Example

This example shows a program for displaying the CQM1’s 8-digit BCD numbers at the 7-segment LED display. Assume that the 7-segment display is connected to output word IR 100. Also assume that the Output Unit is using negative logic, and that the 7-segment display logic is also negative for data signals and latch signals. 25313 (Always ON) 7SEG(88) DM0120 100 004

The 8-digit BCD data in DM 0120 (rightmost 4 digits) and DM 0121 (leftmost 4 digits) are always displayed by means of 7SEG(88). When the contents of DM 0120 and DM 0121 change, the display will also change.

126

Page 147

Section

Advanced I/O Instructions (CQM1 Only)

2-2

2-2-5 Alternate I/O Bits Although the advanced I/O instructions generally using I/O bits starting from bit 00 of the specified words, they can be programmed through intermediate words to use other I/O bits. The following example shows how this can be achieved for HKY(––). Example

The following wiring and program examples show how to use input bits IR 00004 through IR 00007 and output bits IR 10004 through IR 10007 to input values from a hexadecimal keypad. Wiring Diagram (Not Complete)

C

D

E

F

8

9

A

B

4

5

6

7

3

0

1

2

3

5

OD212 0 1 2

ID212

4

0 1

6

2

7

3

8

4

9

5 6 7

Output Unit IR 100

Input terminals IR 000

Note Power supply lines have been omitted.

Program

25313 (Always ON) MOVD(83) 000 #0001

Bits 04 through 07 of IR 000 are transferred to bits 00 through 03 of DM 0000.

DM0000 HKY DM0000 DM0100

HKY is coded using DM 0000 as the input word and DM 0100 as the output word. Execution results are placed in DM 1000 to DM 1002.

DM1000 MOVD (83) DM0100

Bits 00 through 03 of DM 0100 are transferred to bits 04 through 07 of IR 100.

#0100 100

15

0

15 Output

IR 000

0

DM 0100

HKY execution DM 0000

Input

IR 100

127

Page 148

Section

Macro Function

2-3

2-3

Macro Function The macro function allows a single subroutine (programming pattern) to be used by simply changing the I/O word. A number of similar program sections can be managed with just one subroutine, thereby greatly reducing the number of steps in the program and making the program easier to understand.

Using Macros

To use a macro, call a subroutine by means of the MACRO instruction, MCRO(99), as shown below, in stead of SBS(91) (SUBROUTINE ENTRY).

MCRO(99) Subroutine No Fist input word First output word

When MCRO(99) is executed, operation will proceed as follows: 1, 2, 3...

1. The contents of the four consecutive words beginning with the first input word will be transferred to IR 096 through IR 099 (SR 232 through SR 235 in CPM1/CPM1A/SRM1 PCs). The contents of the four consecutive words beginning with the first output word will be transferred to IR 196 through IR 199 (SR 236 through SR 239 in CPM1, CPM1A and SRM1 PCs). 2. The specified subroutine will be executed until RET(93) (Subroutine Return) is executed. 3. The contents of IR 196 through IR 199 (SR 236 through SR 239 in CPM1/ CPM1A/SRM1 PCs) will be transferred to the four consecutive words beginning with the first output word. 4. MCRO(99) will then be finished. When MCRO(99) is executed, the same instruction pattern can be used as needed simply by changing the first input word or the first output word. The following restrictions apply when the macro function is used. • The only words that can be used for each execution of the macro are the four consecutive words beginning with the first input word number (for input) and the four consecutive words beginning with the first output word (for output). • The specified inputs and outputs must correctly correspond to the words used in the subroutine. • Even when the direct output method is used for outputs,subroutine results will be actually reflected in the specified output words only when the subroutine has been completed (step 3 above).

Note

1. In CQM1 PCs, IR 096 to IR 099 and IR 196 to IR 199 can be used as work bits when MCRO(99) is not used. 2. In CPM1/CPM1A/SRM1 PCs, SR 232 through SR 239 can be used as work bits when MCRO(99) is not used. The first input word and the first output word can be specified not with I/O bits, but also with other bits (such as HR bits, work bits, etc.) or with DM words. Subroutines called by MCRO(99) are defined by SBN(92) and RET(93), just as are ordinary subroutines.

128

Page 149

Section

Analog Settings (CQM1-CPU42-EV1/CPM1/CPM1A Only) CQM1 Application Example

2-5

When a macro is used, the program can be simplified as shown below.

Macro not used

Macro used 25313 (Always ON)

00000

10001

MCRO(99) 10000 090 000

10000

100 00001

00002

MCRO(99) 10001

00200

090 002

10501

105

10500 MCRO(99)

10500

090 00201

005

00202 10501

00500

120 MCRO(99)

12001 12000

090 010

12000

150 00501

00502

SBN(92)

12001

01000

09600

15001

19601 19600

15000 19600

15000

01001

090

01002 15001

Subroutine used to define macro

09601

19602 19601

RET(93)

CPM1/CPM1A/SRM1 Application Example

2-4

The CPM1/CPM1A/SRM1 program can be simplified like the one shown above, but words SR 232 through SR 235 would be used instead of IR 096 through IR 099 and words SR 236 through SR 239 would be used instead of IR 196 through IR 199.

Differential Monitor The CQM1/CPM1/CPM1A/SRM1 support differential monitoring from either the Programming Console or the SSS. The operator can detect on OFF-to-ON or ON-to-OFF transition in a specified bit. When the specified transition takes place, the transition is indicated on the display and a buzzer sounds to enable easy recognition of the transition. Refer to the CQM1 Operation Manual, CPM1 Operation Manual, CPM1A Operation Manual or SRM1 Master Control Units Operation Manual for details on the Programming Console Differential Monitor procedure and to the SSS Operation Manual: C-series PCs for the SYSMAC Support Software procedure.

2-5

Analog Settings (CQM1-CPU42-EV1/CPM1/CPM1A Only) In the CQM1-CPU42-EV1/CPM1/CPM1A PCs, the analog settings function automatically transfers the settings on the CPU Unit’s adjustment switches to IR 220 through IR 223. This function is very useful when there are set values that need to be precisely adjusted during operation. These set values can be changed just by turning the adjustment switches on the CPU Unit.

129

Page 150

Analog Settings (CQM1-CPU42-EV1/CPM1/CPM1A Only)

Section

2-5

The adjustment settings are stored in BCD and range from 0000 to 0200. Use a precision screwdriver to adjust the settings. (Turn the switches clockwise to increase the adjustment.) CQM1-CPU42-EV1 Settings

The CQM1-CPU42-EV1 has four analog adjustment controls. The following diagram shows the CQM1-CPU42-EV1 adjustment controls and indicates the corresponding IR words that contain the adjustment settings.

The analog setting for control 0 is in IR 220. The analog setting for control 1 is in IR 221. The analog setting for control 2 is in IR 222. The analog setting for control 3 is in IR 223.

In CQM1 CPU Units other than the CQM1-CPU42-EV1, IR 220 through IR 223 serve no special purpose. They can be used as work words in the program. ! Caution

CPM1/CPM1A Settings

The CQM1-CPU42-EV1 continually refreshes IR 220 through IR 223 with the adjustment settings as long as the power is on. Do not overwrite the content of these words from the program or Peripheral Device.

The CPM1/CPM1A PCs have two analog adjustment controls. The following diagram shows the adjustment controls and indicates the corresponding SR words that contain the adjustment settings. Use a phillips-head screwdriver to adjust the settings.

The analog setting for control 0 is in SR 250. The analog setting for control 1 is in SR 251.

Note The above diagram shows the CPM1, but the settings are the same for CPM1A.

! Caution

130

The analog setting may change with changing temperatures. Do not use the analog adjustment controls for applications that require a precise, fixed setting.

Page 151

Section

Quick-response Inputs (CPM1/CPM1A Only)

2-6

CPM1/CPM1A Program Example The following ladder program uses the CPM1/CPM1A’s analog settings. The analog setting in SR 250 (0000 to 0200 BCD) is determined by adjusting analog adjustment control 0. This value is used to adjust the timer’s set value from 0.0 to 20.0 seconds. Start condition SR 250 is specified as the timer’s set value.

TIM 000

TIM 000 01003

2-6

Quick-response Inputs (CPM1/CPM1A Only) The CPM1/CPM1A have quick response inputs that can be used to enable inputting shorter signals. All 10-point CPU Units have 2 quick-response input terminals and the 20-, 30-, and 40-point CPU Units have 4 quick-response input terminals. The same terminals are used for quick-response inputs and interrupt inputs.

Quick-response Operation

Quick-response inputs have an internal buffer, so input signals shorter than one cycle can be detected. Signals with a pulse width as short as 0.2 ms can be detected, regardless of their timing during the PC cycle. Overseeing processes

Program execution

I/O refreshing

Overseeing Program processes execution

I/O refreshing

Input signal (00003) IR 00003 One cycle

CPU Unit 10-point CPU Units 20-, 30-, 40-point CPU Units

Setting Quick-response Inputs

Input bits IR 00003 to IR 00004 IR 00003 to IR 00006

Min. input pulse width 0.2 ms

The input bits in the above table can be set as quick-response inputs in DM 6628, as shown in the following table. Word DM 6628

Settings 0: Normal input 1: Interrupt input 2: Quick-response input (Default setting: 0) Bit 15

0

DM 6628

Setting for input 00006: Set to 2 Setting for input 00005: Set to 2 Setting for input 00004: Set to 2 Setting for input 00003: Set to 2

131

Page 152

Section

Quick-response Inputs (CPM1/CPM1A Only)

2-6

Program Example In this example, DM 6628 has been set to 0002. 25315 First Cycle Flag ON for 1 cycle @INT(89) 000

Mask/unmask input interrupts.

000 #000E

132

Unmasks 00003 (interrupt input 0), masks others.